@@ -8,6 +8,10 @@ description: |
88 ```
99
1010inputs :
11+ cosign-version :
12+ description : Version of cosign (check latest from https://github.com/sigstore/cosign/releases)
13+ required : false
14+ default : ' v3.0.6'
1115 image-name :
1216 description : Image name
1317 required : true
@@ -17,21 +21,46 @@ inputs:
1721 image-tag :
1822 description : Image tag
1923 required : true
24+ readonly :
25+ description : If true, skip the signing step
26+ required : false
27+ default : ' false'
2028
2129runs :
2230 using : " composite"
2331 steps :
2432 - name : Install Cosign
25- uses : sigstore/cosign-installer@v4.0.0
26- with :
27- cosign-release : ' v3.0.3'
33+ run : |
34+ echo "Downloading Cosign binary and checksums..."
35+ curl -sL -O https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/${COSIGN_BINARY}
36+ curl -sL -O "https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/${COSIGN_CHECKSUM_FILE}"
37+
38+ echo "Verifying checksum..."
39+ grep "${COSIGN_BINARY}$" "${COSIGN_CHECKSUM_FILE}" | sha256sum --check --status
40+
41+ if [ $? -eq 0 ]; then
42+ echo "Verification successful!"
43+ rm $COSIGN_CHECKSUM_FILE
44+ chmod +x $COSIGN_BINARY
45+ sudo mv $COSIGN_BINARY /usr/local/bin/cosign
46+ cosign version
47+ else
48+ echo "ERROR: Checksum verification failed!" >&2
49+ exit 1
50+ fi
51+ shell : bash
52+ env :
53+ COSIGN_BINARY : cosign-linux-amd64
54+ COSIGN_CHECKSUM_FILE : cosign_checksums.txt
55+ COSIGN_VERSION : ${{ inputs.cosign-version }}
2856 - name : Get image digest
2957 id : digest
3058 run : |
3159 DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ inputs.image-path }}/${{ inputs.image-name }}:${{ inputs.image-tag }} | cut -d'@' -f2)
3260 echo "DIGEST=$DIGEST" >> $GITHUB_OUTPUT
3361 shell : bash
3462 - name : Sign image with Cosign
63+ if : inputs.readonly != 'true'
3564 env :
3665 COSIGN_EXPERIMENTAL : 1
3766 run : |
0 commit comments