Skip to content

Commit da654f7

Browse files
committed
add release workflow
1 parent 4e9c31e commit da654f7

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/release.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
env:
9+
ARCH: ["amd64", "arm64"]
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
build-and-release:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
# NB: actions/checkout quietly fetches all tags as lightweight tags,
25+
# even if they’re annotated upstream. That, of course, prevents use
26+
# of the tag message as release notes. This works around that.
27+
#
28+
# See https://github.com/actions/checkout/issues/290 for details.
29+
- name: Fetch tags
30+
run: git fetch --tags --force
31+
32+
- name: Set up Go
33+
uses: actions/setup-go@v4
34+
35+
- name: Build
36+
run: |
37+
set -o errexit
38+
39+
TAG_NAME=$(git describe --exact-match)
40+
git tag --list --format='%(contents)' "$TAG_NAME" > RELEASE-NOTES
41+
42+
for arch in $ARCH; do
43+
docker build . \
44+
--platform "linux/$ARCH" \
45+
--output "type=docker,dest=${{ github.repository_name }}-$TAG_NAME-$ARCH.tar"
46+
done
47+
48+
- name: Create Release
49+
uses: softprops/action-gh-release@v2
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
with:
53+
body_path: RELEASE-NOTES
54+
files: *.tar

0 commit comments

Comments
 (0)