Skip to content

Commit 6516697

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 8a092ac commit 6516697

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/release.yml

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

0 commit comments

Comments
 (0)