@@ -30,17 +30,17 @@ jobs:
3030
3131 steps :
3232 - name : Checkout code
33- uses : actions/checkout@v4
33+ uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
3434
3535 - name : Set up Go
36- uses : actions/setup-go@v5
36+ uses : actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
3737 with :
3838 go-version : ' ${{ env.GO_VERSION }}'
3939 cache : true
4040 cache-dependency-path : cli/go.sum
4141
4242 - name : Cache Go tools
43- uses : actions/cache@v4
43+ uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
4444 with :
4545 path : ~/go/bin
4646 key : go-tools-${{ runner.os }}-${{ hashFiles('cli/go.sum') }}
@@ -95,10 +95,10 @@ jobs:
9595
9696 steps :
9797 - name : Checkout code
98- uses : actions/checkout@v4
98+ uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
9999
100100 - name : Set up Go
101- uses : actions/setup-go@v5
101+ uses : actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
102102 with :
103103 go-version : ' ${{ env.GO_VERSION }}'
104104 cache : true
@@ -116,7 +116,7 @@ jobs:
116116
117117 - name : Upload coverage to Codecov
118118 if : github.repository == 'jongio/azd-rest'
119- uses : codecov/codecov-action@v4
119+ uses : codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4
120120 with :
121121 file : coverage/coverage.out
122122 flags : unittests
@@ -125,21 +125,8 @@ jobs:
125125 fail_ci_if_error : false
126126 verbose : true
127127
128- build :
129- name : Build
130- runs-on : ubuntu-latest
131- needs : [preflight, test]
132- timeout-minutes : 30
133- defaults :
134- run :
135- working-directory : cli
136-
137- steps :
138- - name : Checkout code
139- uses : actions/checkout@v4
140-
141128 - name : Set up Go
142- uses : actions/setup-go@v5
129+ uses : actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
143130 with :
144131 go-version : ' ${{ env.GO_VERSION }}'
145132 cache : true
@@ -154,7 +141,7 @@ jobs:
154141 GOOS=darwin GOARCH=arm64 go build -o bin/darwin-arm64/rest ./src/cmd/rest
155142
156143 - name : Upload artifacts
157- uses : actions/upload-artifact@v4
144+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
158145 with :
159146 name : binaries
160147 path : cli/bin/
@@ -167,15 +154,16 @@ jobs:
167154 permissions :
168155 contents : write
169156 pull-requests : write
157+ id-token : write # Required for cosign OIDC signing
170158
171159 steps :
172160 - name : Checkout
173- uses : actions/checkout@v4
161+ uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
174162 with :
175163 fetch-depth : 0
176164
177165 - name : Set up Go
178- uses : actions/setup-go@v5
166+ uses : actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
179167 with :
180168 go-version : ' ${{ env.GO_VERSION }}'
181169 cache : true
@@ -401,6 +389,54 @@ jobs:
401389 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
402390 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
403391
392+ - name : Install cosign
393+ uses : sigstore/cosign-installer@3454372be43e8ddeec39df0f73bb47954da3a1f1 # v3
394+
395+ - name : Install syft
396+ uses : anchore/sbom-action/download-syft@e11c554f704a0b820cbf8c51673f6945e0731532 # v0
397+
398+ - name : Sign release artifacts with cosign
399+ working-directory : cli
400+ run : |
401+ VERSION="${{ steps.version.outputs.next }}"
402+ TAG_NAME="azd-ext-jongio-azd-rest_${VERSION}"
403+ echo "Signing release artifacts for ${TAG_NAME}..."
404+
405+ # Download release assets
406+ gh release download "${TAG_NAME}" --dir /tmp/release-assets --repo "${{ github.repository }}" || true
407+
408+ # Sign each artifact
409+ if [ -d /tmp/release-assets ]; then
410+ for file in /tmp/release-assets/*; do
411+ if [ -f "$file" ]; then
412+ echo "Signing $(basename $file)..."
413+ cosign sign-blob --yes "$file" --output-signature "${file}.sig" --output-certificate "${file}.pem"
414+ fi
415+ done
416+
417+ # Upload signatures and certificates to the release
418+ gh release upload "${TAG_NAME}" /tmp/release-assets/*.sig /tmp/release-assets/*.pem --repo "${{ github.repository }}" || true
419+ echo "✅ All artifacts signed with cosign (keyless/OIDC)"
420+ fi
421+ env :
422+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
423+
424+ - name : Generate SBOM
425+ working-directory : cli
426+ run : |
427+ VERSION="${{ steps.version.outputs.next }}"
428+ TAG_NAME="azd-ext-jongio-azd-rest_${VERSION}"
429+ echo "Generating SBOM for ${TAG_NAME}..."
430+
431+ # Generate SBOM for the Go module
432+ syft . -o spdx-json=/tmp/sbom-spdx.json -o cyclonedx-json=/tmp/sbom-cyclonedx.json
433+
434+ # Upload SBOM to the release
435+ gh release upload "${TAG_NAME}" /tmp/sbom-spdx.json /tmp/sbom-cyclonedx.json --repo "${{ github.repository }}" || true
436+ echo "✅ SBOM generated and uploaded (SPDX + CycloneDX)"
437+ env :
438+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
439+
404440 - name : Update registry
405441 working-directory : cli
406442 run : |
0 commit comments