Skip to content

Commit d5e7ba5

Browse files
authored
ci: Refactor release workflow for checksums and SBOM
Refactor release workflow to consolidate checksum generation and improve SBOM signing process.
1 parent a3d3705 commit d5e7ba5

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ jobs:
5959

6060
prepare-artifacts:
6161
name: Prepare release artifacts
62-
needs: create-draft-release
6362
runs-on: ubuntu-24.04
6463
permissions:
6564
contents: read
@@ -86,10 +85,12 @@ jobs:
8685
SECURITY.md \
8786
SUPPORT.md
8887
89-
# Create checksums
88+
# Create consolidated checksums.txt with sha256 lines for each tarball
9089
cd release
91-
sha256sum terraform-gcp-${VERSION}.tar.gz > terraform-gcp-${VERSION}.tar.gz.sha256
92-
sha512sum terraform-gcp-${VERSION}.tar.gz > terraform-gcp-${VERSION}.tar.gz.sha512
90+
: > checksums.txt
91+
for f in *.tar.gz; do
92+
sha256sum "$f" >> checksums.txt
93+
done
9394
9495
- name: Upload artifacts
9596
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@@ -135,18 +136,19 @@ jobs:
135136
- name: Sign release artifacts
136137
run: |
137138
cd release
138-
139-
# Sign the tarball
140139
cosign sign-blob \
141140
--bundle terraform-gcp-${VERSION}.tar.gz.bundle \
142141
terraform-gcp-${VERSION}.tar.gz
143-
144-
- name: Sign SBOM
142+
143+
- name: Create SBOM attestation for the archive
145144
run: |
146-
# Sign the SBOM file
147-
cosign sign-blob \
145+
# Attach the SBOM to the tarball as an attestation bundle
146+
cosign attest-blob -y \
147+
--type cyclonedx \
148+
--new-bundle-format \
149+
--predicate terraform-gcp-${{ env.VERSION }}.sbom \
148150
--bundle terraform-gcp-${{ env.VERSION }}.sbom.bundle \
149-
terraform-gcp-${{ env.VERSION }}.sbom
151+
release/terraform-gcp-${{ env.VERSION }}.tar.gz
150152
151153
- name: Upload signed artifacts
152154
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@@ -191,19 +193,20 @@ jobs:
191193
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
192194
release/terraform-gcp-${VERSION}.tar.gz
193195
194-
- name: Verify SBOM signature
196+
- name: Verify SBOM attestation
195197
run: |
196-
cosign verify-blob \
198+
cosign verify-blob-attestation \
199+
--type cyclonedx \
200+
--new-bundle-format \
197201
--bundle signed/terraform-gcp-${VERSION}.sbom.bundle \
198202
--certificate-identity "https://github.com/${{ github.workflow_ref }}" \
199203
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
200-
signed/terraform-gcp-${VERSION}.sbom
204+
release/terraform-gcp-${VERSION}.tar.gz
201205
202206
- name: Verify checksums
203207
run: |
204208
cd release
205-
sha256sum -c terraform-gcp-${VERSION}.tar.gz.sha256
206-
sha512sum -c terraform-gcp-${VERSION}.tar.gz.sha512
209+
sha256sum -c checksums.txt
207210
208211
publish-release:
209212
name: Publish release
@@ -276,4 +279,4 @@ jobs:
276279
EOF
277280
)
278281
279-
curl -sS -H "Content-Type: application/json" -X POST -d "$PAYLOAD" "$WEBHOOK" || true
282+
curl -sS -H "Content-Type: application/json" -X POST -d "$PAYLOAD" "$WEBHOOK" || true

0 commit comments

Comments
 (0)