-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (63 loc) · 2.21 KB
/
Copy pathrelease.yml
File metadata and controls
76 lines (63 loc) · 2.21 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: release
on:
push:
tags: ["v*"]
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 30
if: github.repository == 'siliconwitchery/superstack-cli'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
check-latest: true
- name: Verify the tag is on main
run: |
git fetch --no-tags origin main
if ! git merge-base --is-ancestor "$GITHUB_SHA" FETCH_HEAD; then
echo "$GITHUB_REF_NAME points at a commit that is not on main"
exit 1
fi
- name: Verify the tag matches the version in main.go
run: |
declared=$(sed -n 's/^const version = "\(.*\)"$/\1/p' main.go)
tagged="${GITHUB_REF_NAME#v}"
if [ -z "$declared" ]; then
echo "could not read 'const version' from main.go"
exit 1
fi
if [ "$declared" != "$tagged" ]; then
echo "tag $GITHUB_REF_NAME implies $tagged, but main.go declares $declared"
exit 1
fi
- name: Verify the publishing credentials are present
env:
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
AUR_KEY: ${{ secrets.AUR_KEY }}
run: |
if [ -z "$TAP_GITHUB_TOKEN" ]; then
echo "TAP_GITHUB_TOKEN is unset, and GoReleaser would skip the tap and bucket uploads without failing"
exit 1
fi
if [ -z "$AUR_KEY" ]; then
echo "AUR_KEY is unset, and GoReleaser would skip the AUR upload without failing"
exit 1
fi
- uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
AUR_KEY: ${{ secrets.AUR_KEY }}