Skip to content

Commit ac08b11

Browse files
authored
Make release workflow compatible with immutable releases (#8454)
Separate the release workflow into three sequential jobs. The first simply creates a draft release, the second (which can be multiple parallel jobs, if there's a matrix of go versions) builds all the relevant release artifacts and uploads them to container registries and to the release itself, and the third takes the release out of draft mode if and only if the previous jobs succeeded. This separation allows us to adopt Immutable Releases, which can provide attestations that release artifacts are not modified after they're created. This is because the release only becomes immutable once it is taken out of draft mode, so as long as it's just a draft, multiple different jobs can upload artifacts to it. Along the way, make a few other small improvements to the release workflow, such as avoiding directly interpolating ${{ github.ref_name }} and using a pinned version of the docker/login-action to authenticate to ghcr. Fixes #8380
1 parent c857e52 commit ac08b11

File tree

2 files changed

+55
-24
lines changed

2 files changed

+55
-24
lines changed

.github/workflows/release.yml

Lines changed: 49 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,42 @@
11
# Build the Boulder Debian package on tag push, and attach it to a GitHub
22
# release.
33
#
4-
# Keep in sync with try-release.yml, with the exception that try-release.yml can
5-
# have multiple entries in its matrix but this should only have one.
4+
# Keep the GO_VERSION matrix and the container-building steps in sync with
5+
# try-release.yml.
66
name: Build release
77
on:
88
push:
99
tags:
1010
- '**'
1111

1212
jobs:
13+
draft-release:
14+
runs-on: ubuntu-24.04
15+
permissions:
16+
contents: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
persist-credentials: false
21+
fetch-depth: '0' # Needed for verify-release-ancestry.sh to see origin/main
22+
23+
- name: Verify release ancestry
24+
run: ./tools/verify-release-ancestry.sh "$GITHUB_SHA"
25+
26+
- name: Create draft release
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
# https://cli.github.com/manual/gh_release_create
30+
run: gh release create --draft --generate-notes "${GITHUB_REF_NAME}"
31+
1332
push-release:
33+
needs: draft-release
1434
strategy:
1535
fail-fast: false
1636
matrix:
1737
GO_VERSION:
1838
- "1.25.2"
39+
- "1.25.3"
1940
runs-on: ubuntu-24.04
2041
permissions:
2142
contents: write
@@ -26,47 +47,55 @@ jobs:
2647
persist-credentials: false
2748
fetch-depth: '0' # Needed for verify-release-ancestry.sh to see origin/main
2849

29-
- name: Verify release ancestry
30-
run: ./tools/verify-release-ancestry.sh "$GITHUB_SHA"
31-
3250
- name: Build Boulder container and .deb
3351
id: build
3452
env:
3553
GO_VERSION: ${{ matrix.GO_VERSION }}
3654
run: ./tools/container-build.sh
3755

3856
- name: Tag Boulder container
39-
run: docker tag boulder "ghcr.io/letsencrypt/boulder:${{ github.ref_name }}-go${{ matrix.GO_VERSION }}"
57+
run: docker tag boulder "ghcr.io/letsencrypt/boulder:${GITHUB_REF_NAME}-go${{ matrix.GO_VERSION }}"
4058

4159
- name: Compute checksums
4260
id: checksums
4361
# The files listed on this line must be identical to the files uploaded
4462
# in the last step.
4563
run: sha256sum boulder*.deb boulder*.tar.gz >| boulder-${{ matrix.GO_VERSION }}.$(date +%s)-$(git rev-parse --short=8 HEAD).checksums.txt
4664

47-
- name: Create release
48-
env:
49-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50-
# https://cli.github.com/manual/gh_release_create
51-
run: gh release create --generate-notes "${GITHUB_REF_NAME}"
52-
continue-on-error: true
53-
5465
- name: Upload release files
5566
env:
5667
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5768
# https://cli.github.com/manual/gh_release_upload
5869
run: gh release upload "${GITHUB_REF_NAME}" boulder*.deb boulder*.tar.gz boulder*.checksums.txt
5970

6071
- name: Build ct-test-srv container
61-
run: docker buildx build . --build-arg "GO_VERSION=${{ matrix.GO_VERSION }}" -f test/ct-test-srv/Dockerfile -t "ghcr.io/letsencrypt/ct-test-srv:${{ github.ref_name }}-go${{ matrix.GO_VERSION }}"
72+
run: docker buildx build . --build-arg "GO_VERSION=${{ matrix.GO_VERSION }}" -f test/ct-test-srv/Dockerfile -t "ghcr.io/letsencrypt/ct-test-srv:${GITHUB_REF_NAME}-go${{ matrix.GO_VERSION }}"
6273

63-
- name: Login to ghcr.io
64-
run: printenv GITHUB_TOKEN | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
65-
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
- name: Login to GitHub Container Registry
75+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
76+
with:
77+
registry: ghcr.io
78+
username: ${{ github.actor }}
79+
password: ${{ secrets.GITHUB_TOKEN }}
6780

6881
- name: Push Boulder container
69-
run: docker push "ghcr.io/letsencrypt/boulder:${{ github.ref_name }}-go${{ matrix.GO_VERSION }}"
82+
run: docker push "ghcr.io/letsencrypt/boulder:${GITHUB_REF_NAME}-go${{ matrix.GO_VERSION }}"
7083

7184
- name: Push ct-test-srv container
72-
run: docker push "ghcr.io/letsencrypt/ct-test-srv:${{ github.ref_name }}-go${{ matrix.GO_VERSION }}"
85+
run: docker push "ghcr.io/letsencrypt/ct-test-srv:${GITHUB_REF_NAME}-go${{ matrix.GO_VERSION }}"
86+
87+
publish-release:
88+
needs: push-release
89+
runs-on: ubuntu-24.04
90+
permissions:
91+
contents: write
92+
steps:
93+
- uses: actions/checkout@v4
94+
with:
95+
persist-credentials: false
96+
97+
- name: Publish release
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100+
# https://cli.github.com/manual/gh_release_edit
101+
run: gh release edit --draft=false "${GITHUB_REF_NAME}"

.github/workflows/try-release.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# Try building the Boulder Debian package on every PR and push to main.
2-
# This is to make sure the actual release job will succeed when we tag a
3-
# release.
4-
# Keep in sync with release.yml
1+
# Try building the Boulder Debian package on every PR and push to main. This is
2+
# to make sure the actual release job will succeed when we tag a release.
3+
#
4+
# Keep the GO_VERSION matrix and the container-building steps in sync with
5+
# release.yml.
56
name: Try release
67
on:
78
push:
@@ -20,6 +21,7 @@ jobs:
2021
matrix:
2122
GO_VERSION:
2223
- "1.25.2"
24+
- "1.25.3"
2325
runs-on: ubuntu-24.04
2426
steps:
2527
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)