Skip to content

Commit aea9a53

Browse files
authored
Merge pull request #9 from mook-as/ci/release
CI: Add workflow to upload release assets
2 parents c57f78e + f7baf31 commit aea9a53

3 files changed

Lines changed: 55 additions & 1 deletion

File tree

.github/workflows/build.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
name: Build
22
on:
33
push:
4+
branches: [ '**' ]
5+
tags-ignore: [ 'v*', 'test-v*' ]
46
pull_request:
7+
workflow_call:
58
workflow_dispatch:
69
permissions:
710
contents: read
@@ -58,7 +61,7 @@ jobs:
5861
make GOARCH=${{ matrix.arch }} distro.${{ matrix.type }}
5962
6063
- name: Upload artifacts
61-
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
64+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
6265
with:
6366
name: distro-${{ matrix.type }}-${{ matrix.arch }}
6467
path: distro.${{ matrix.type }}

.github/workflows/release.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release Artifacts
2+
on:
3+
push:
4+
tags: [ 'v*', 'test-v*' ]
5+
permissions:
6+
contents: read
7+
jobs:
8+
build:
9+
name: Build Artifacts
10+
uses: ./.github/workflows/build.yaml
11+
upload:
12+
name: Create Release
13+
needs: build
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write # Needed to create releases.
17+
steps:
18+
- name: Download artifacts
19+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
20+
with:
21+
pattern: distro-*
22+
- name: Extract artifacts
23+
run: |
24+
set -o errexit -o nounset -o xtrace
25+
for arch in amd64 arm64; do
26+
mv distro-qcow2-${arch}/distro.qcow2 distro.${GITHUB_REF_NAME}.${arch}.qcow2
27+
rmdir distro-qcow2-${arch}/
28+
mv distro-tar.xz-${arch}/distro.tar.xz distro.${GITHUB_REF_NAME}.${arch}.tar.xz
29+
rmdir distro-tar.xz-${arch}/
30+
done
31+
for f in distro.*.{qcow2,tar.xz}; do
32+
sha256sum "$f" > "$f.sha256"
33+
done
34+
- name: Create release
35+
run: >-
36+
gh release create
37+
--title "${GITHUB_REF_NAME#test-}"
38+
--draft
39+
--generate-notes
40+
--verify-tag
41+
--repo ${{ github.repository }}
42+
"${GITHUB_REF_NAME}"
43+
distro.*.{qcow2,tar.xz}{,.sha256}
44+
env:
45+
GH_TOKEN: ${{ github.token }}

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,9 @@ architecture as used by the [go toolchain]. This requires your docker daemon to
1414
be able to emulate that architecture.
1515

1616
[go toochain]: https://go.dev/doc/install/source#environment
17+
18+
## Release Process
19+
20+
Push a tag of the form `v*` (or `test-v*` for testing if testing in a fork is
21+
not possible), and the [release workflow](.github/workflows/release.yaml) will
22+
create a draft release with the artifacts.

0 commit comments

Comments
 (0)