Skip to content

Commit 77a4064

Browse files
authored
feat: publish release attestations (#1069)
* feat: publish release attestations Allows users to trust that release artifacts are not tampered * chore: bump to release semver
1 parent 1964f77 commit 77a4064

File tree

2 files changed

+55
-17
lines changed

2 files changed

+55
-17
lines changed

.github/workflows/publish.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Publish new releases to Bazel Central Registry.
2+
name: Publish
3+
on:
4+
# Run the publish workflow after a successful release
5+
# Will be triggered from the release.yaml workflow
6+
workflow_call:
7+
inputs:
8+
tag_name:
9+
required: true
10+
type: string
11+
secrets:
12+
publish_token:
13+
required: true
14+
# In case of problems, let release engineers retry by manually dispatching
15+
# the workflow from the GitHub UI
16+
workflow_dispatch:
17+
inputs:
18+
tag_name:
19+
required: true
20+
type: string
21+
jobs:
22+
publish:
23+
uses: bazel-contrib/publish-to-bcr/.github/workflows/[email protected]
24+
with:
25+
tag_name: ${{ inputs.tag_name }}
26+
# GitHub repository which is a fork of the upstream where the Pull Request will be opened.
27+
registry_fork: bazel-contrib/bazel-central-registry
28+
permissions:
29+
attestations: write
30+
contents: write
31+
id-token: write
32+
secrets:
33+
# Necessary to push to the BCR fork, and to open a pull request against a registry
34+
publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }}

.github/workflows/release.yml

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
push:
77
tags:
88
- "v*.*.*"
9+
permissions:
10+
id-token: write
11+
attestations: write
12+
contents: write
913
jobs:
1014
build:
1115
# Go cross-compilation works from linux -> any platform
@@ -26,22 +30,22 @@ jobs:
2630
name: artifacts
2731
path: artifacts/
2832
retention-days: 1
33+
- uses: actions/attest-build-provenance@v2
34+
with:
35+
subject-path: artifacts/*
2936
release:
3037
needs: build
31-
runs-on: ubuntu-latest
32-
steps:
33-
- uses: actions/checkout@v4
34-
# Fetch the built artifacts from build jobs above and extract into
35-
# ${GITHUB_WORKSPACE}/artifacts/*
36-
- uses: actions/download-artifact@v4
37-
- name: Prepare workspace snippet
38-
run: .github/workflows/release_prep.sh > release_notes.txt
39-
- uses: softprops/action-gh-release@v2
40-
with:
41-
# Use GH feature to populate the changelog automatically
42-
generate_release_notes: true
43-
files: |
44-
artifacts/*
45-
bazel-lib-*.tar.gz
46-
body_path: release_notes.txt
47-
fail_on_unmatched_files: true
38+
uses: bazel-contrib/.github/.github/workflows/[email protected]
39+
with:
40+
release_files: |
41+
artifacts/*
42+
bazel-lib-*.tar.gz
43+
prerelease: false
44+
tag_name: ${{ github.ref_name }}
45+
publish:
46+
needs: release
47+
uses: ./.github/workflows/publish.yaml
48+
with:
49+
tag_name: ${{ github.ref_name }}
50+
secrets:
51+
publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }}

0 commit comments

Comments
 (0)