Skip to content

Commit f729c3a

Browse files
committed
ci: archive release source
Upon release, eagerly provide a stable archive of the release source. It used to be that GitHub's (and GitLab's?) virtual source code assets were generated on demand to limit resource consumption. This meant the assets were not reliably available, and that two instances of the same asset downloaded long apart could be generated with different implementations, causing different checksums for the same contents. Eventually somebody raised an overly dramatic stink about this and GitHub promised to make the archive generation stable but I don't want to rely on that promise.
1 parent 6397ffd commit f729c3a

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,41 @@ permissions:
1010

1111
jobs:
1212

13+
archive-src:
14+
name: archive-src
15+
runs-on: ubuntu-22.04
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
persist-credentials: false
21+
22+
- name: Install dependencies
23+
run: |
24+
sudo apt-get update
25+
sudo apt-get install --yes --no-install-recommends \
26+
lzip
27+
28+
- name: Archive source code
29+
shell: bash
30+
run: |
31+
v="${GITHUB_REF#refs/tags/}"
32+
release_name="commitmsgfmt-$v"
33+
asset_name="${release_name}.tar.lz"
34+
35+
git archive --prefix="${release_name}/" --format=tar "$v" |
36+
lzip -6 >"$asset_name"
37+
38+
printf 'ASSET=%s\n' "$asset_name" >> $GITHUB_ENV
39+
printf 'RELEASE_VERSION=%s\n' "$v" >> $GITHUB_ENV
40+
41+
- name: Upload source code archive
42+
uses: softprops/action-gh-release@v1
43+
with:
44+
draft: true
45+
tag_name: ${{ env.RELEASE_VERSION }}
46+
files: ${{ env.ASSET }}
47+
1348
build-package:
1449
name: build-package
1550
runs-on: ${{ matrix.os }}

0 commit comments

Comments
 (0)