-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (51 loc) · 1.69 KB
/
Copy pathrelease.yml
File metadata and controls
54 lines (51 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22.x"
- name: Verify tag matches VERSION
shell: bash
run: |
set -euo pipefail
version="v$(tr -d '[:space:]' < VERSION)"
if [ "$version" != "$GITHUB_REF_NAME" ]; then
echo "tag $GITHUB_REF_NAME does not match VERSION file ($version); bump VERSION and internal/anigate/version.go first" >&2
exit 1
fi
- name: Build release archives
shell: bash
run: |
set -euo pipefail
mkdir -p dist
targets=(
"linux amd64"
"linux arm64"
"darwin amd64"
"darwin arm64"
)
for target in "${targets[@]}"; do
read -r goos goarch <<<"$target"
out="anigate-${GITHUB_REF_NAME}-${goos}-${goarch}"
mkdir -p "dist/${out}"
for bin in anigate-mini anigate-max anigate; do
GOOS="$goos" GOARCH="$goarch" CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o "dist/${out}/${bin}" "./cmd/${bin}"
done
cp README.md README.zh-CN.md LICENSE "dist/${out}/"
tar -C dist -czf "dist/${out}.tar.gz" "$out"
rm -rf "dist/${out}"
done
(cd dist && sha256sum *.tar.gz > checksums.txt)
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "$GITHUB_REF_NAME" dist/*.tar.gz dist/checksums.txt --title "$GITHUB_REF_NAME" --generate-notes