Skip to content

Commit 386c0c7

Browse files
committed
release.yml: create release pipeline
Create a basic release pipeline that triggers when a tag of the correct format ("v<number>.<number>.<number>...") is pushed. The pipeline generates three artifacts: 1. An x86/64 .deb binary package 2. An x86/64 MacOS .pkg 3. An ARM64 MacOS .pkg At the moment, these packages are simply uploaded as artifacts in the workflow. In the future, the goal is to automatically create and attach these artifacts to a draft release, to allow maintainers to add release note details then publish with the necessary attachments. Note that the tag filtering in GitHub Actions isn't fancy enough to allow for full verification of the version, so a tag like "v1a.2b.3c-xyz" would trigger the pipeline. Better protections will be put in place later, but for now we can rely on maintainers to push only valid tags for the pipeline. Signed-off-by: Victoria Dye <[email protected]>
1 parent 8dd778e commit 386c0c7

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/release.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]*.[0-9]*.[0-9]*' # matches "v<number...>.<number...>.<number>..."
7+
8+
jobs:
9+
# Check prerequisites for the workflow
10+
prereqs:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
tag_version: ${{ steps.tag.outputs.version }} # The version number (without preceding "v"), e.g. 1.0.0
14+
steps:
15+
- name: Determine tag to build
16+
run: |
17+
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
18+
id: tag
19+
20+
package:
21+
needs: prereqs
22+
name: ${{matrix.jobs.jobname}}
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
jobs:
27+
- jobname: Create MacOS .pkg (x86_64)
28+
goarch: amd64
29+
pool: macos-latest
30+
artifact: _dist/*.pkg
31+
- jobname: Create MacOS .pkg (ARM64)
32+
goarch: arm64
33+
pool: macos-latest
34+
artifact: _dist/*.pkg
35+
- jobname: Create binary Debian package (x86_64)
36+
goarch: amd64
37+
pool: ubuntu-latest
38+
artifact: _dist/*.deb
39+
env:
40+
GOARCH: ${{matrix.jobs.goarch}}
41+
runs-on: ${{matrix.jobs.pool}}
42+
steps:
43+
- name: Setup Go
44+
uses: actions/setup-go@v3
45+
with:
46+
go-version: '1.19.0'
47+
- name: Clone repository
48+
uses: actions/checkout@v3
49+
- name: Build the release artifact
50+
run: make package VERSION=${{ needs.prereqs.outputs.tag_version }}
51+
- name: Get the release artifact
52+
shell: bash
53+
run: |
54+
artifacts=(${{matrix.jobs.artifact}})
55+
56+
# Get path to, and name of, artifact
57+
artifactPath="${artifacts[0]}"
58+
artifactName=$(basename "$artifactPath")
59+
60+
# Export variables to environment
61+
echo "artifactPath=$artifactPath" >> $GITHUB_ENV
62+
echo "artifactName=$artifactName" >> $GITHUB_ENV
63+
- name: Upload release artifact
64+
uses: actions/upload-artifact@v3
65+
with:
66+
name: ${{env.artifactName}}
67+
path: ${{github.workspace}}/${{env.artifactPath}}
68+
if-no-files-found: error

0 commit comments

Comments
 (0)