-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (42 loc) · 1.61 KB
/
Copy pathrelease.yml
File metadata and controls
47 lines (42 loc) · 1.61 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
name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: "1.23"
cache: true
# Catch the easy mistake of pushing a tag without bumping VERSION.
# docops update-check fetches VERSION via raw.githubusercontent.com,
# so a mismatch silently breaks "is upgrade available" for everyone
# who already has the previous release. Fail loud here instead.
- name: Verify VERSION matches tag
run: |
tag_version="${GITHUB_REF#refs/tags/v}"
file_version=$(tr -d '[:space:]' < VERSION)
if [ "$tag_version" != "$file_version" ]; then
echo "::error::tag $GITHUB_REF (=$tag_version) does not match VERSION file (=$file_version)"
echo "::error::run 'make release VERSION=$tag_version' on main to do this correctly"
exit 1
fi
- uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Cross-repo tap/bucket pushes need a PAT with `Contents: read/write`
# on logicwind/homebrew-tap + logicwind/scoop-bucket. Single secret,
# aliased to both env var names goreleaser recognises.
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
SCOOP_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}