Skip to content

Commit f6978f3

Browse files
authored
Improve github release artifacts (#6092)
Generate .deb packages for all currently configured Go versions (usually the current and upcoming versions that we use in prod), rather than just the one default version. Also ensure that the uploaded artifacts have 8-character short hashes in their names. Unfortunately this does require updating Go versions in one additional place (the release.yml file), since we are no longer parsing it out of the docker-compose.yml. This is unavoidable without hacks that I consider to be even uglier than the repetition. Fixes #6075 Fixes #6084
1 parent 507c0d1 commit f6978f3

File tree

2 files changed

+35
-20
lines changed

2 files changed

+35
-20
lines changed

.github/workflows/release.yml

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ on:
1212

1313
jobs:
1414
build-release:
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
GO_VERSION:
19+
- 1.17.9
20+
- 1.18.1
1521
runs-on: ubuntu-20.04
1622
permissions:
1723
contents: read
@@ -20,14 +26,22 @@ jobs:
2026
with:
2127
persist-credentials: false
2228

23-
- name: build deb
29+
# This step will create an output called `filename` which contains the
30+
# path of the produced .deb file.
31+
- name: Build .deb
32+
id: build
33+
env:
34+
GO_VERSION: ${{ matrix.GO_VERSION }}
2435
run: ./tools/make-deb.sh
2536

26-
- name: upload deb
37+
# Because each copy of this job (one for each entry in the matrix) uploads
38+
# to the same artifact name, all of the files will live side-by-side in
39+
# the same artifact, and can be downloaded as a single unit.
40+
- name: Upload .deb
2741
uses: actions/upload-artifact@v3
2842
with:
29-
name: boulder deb
30-
path: boulder.deb
43+
name: boulder_debs
44+
path: ${{ steps.build.outputs.filename }}
3145

3246
push-release:
3347
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
@@ -36,18 +50,17 @@ jobs:
3650
permissions:
3751
contents: write
3852
steps:
39-
- uses: actions/checkout@v2
40-
with:
41-
persist-credentials: false
42-
43-
- name: Download release artifact
53+
# This downloads every artifact uploaded by the matrix jobs above,
54+
# directly into the current pwd.
55+
- name: Download .debs
56+
id: download
4457
uses: actions/download-artifact@v3
4558
with:
46-
name: boulder deb
47-
- name: rename
48-
run: mv boulder.deb boulder-1.0.0-$(git rev-parse --short HEAD).x86_64.deb
49-
- name: push release
59+
name: boulder_debs
60+
61+
# We have to pass the -R flag here because this job skipped checkout.
62+
- name: Create release
5063
env:
5164
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5265
# https://cli.github.com/manual/gh_release_create
53-
run: gh release create "${GITHUB_REF_NAME}" boulder-1.0.0-$(git rev-parse --short HEAD).x86_64.deb
66+
run: gh release -R ${{ github.repository }} create "${GITHUB_REF_NAME}" boulder*.deb

tools/make-deb.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ sudo apt-get install -y --no-install-recommends \
1818
ruby-dev \
1919
gcc
2020

21-
# Parse our production Go version from our docker-compose file.
22-
GO_VERSION=$(grep "BOULDER_TOOLS_TAG:-" docker-compose.yml | sed -e 's/.*-go//' -e 's/_.*//')
23-
24-
# Download and unpack our production go version.
21+
# Download and unpack our production go version. Ensure that $GO_VERSION is
22+
# already set in the environment (e.g. by the github actions release workflow).
2523
$(dirname -- "${0}")/fetch-and-verify-go.sh "${GO_VERSION}"
2624
sudo tar -C /usr/local -xzf go.tar.gz
2725
export PATH=/usr/local/go/bin:$PATH
@@ -37,8 +35,12 @@ sudo gem install --no-document -v 1.14.0 fpm
3735
# it to /tmp.
3836
export ARCHIVEDIR="${PWD}"
3937

38+
# Set $VERSION to be a simulacrum of what is set in other build environments.
39+
export VERSION="${GO_VERSION}.$(date +%s)"
40+
4041
# Build Boulder and produce a Debian Package at $PWD.
4142
make deb
4243

43-
# Rename .deb to a predictable path.
44-
mv boulder-*.deb boulder.deb
44+
# We expect the final filename produced by `make deb` to be consistent.
45+
# Print it so that the github action can grab it as an output.
46+
echo ::set-output name=filename::boulder-${VERSION}-$(git rev-parse --short=8 HEAD).x86_64.deb

0 commit comments

Comments
 (0)