-
Notifications
You must be signed in to change notification settings - Fork 1.3k
86 lines (73 loc) · 2.53 KB
/
release.yml
File metadata and controls
86 lines (73 loc) · 2.53 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
77
78
79
80
81
82
83
84
85
86
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
go-version: '1.26'
- name: Install cross-compilation toolchains
run: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64-x86-64 gcc-aarch64-linux-gnu
- name: Reject replace directives in go.mod
run: |
if grep -qE '^replace\s' go.mod; then
echo "ERROR: go.mod contains replace directives — aborting release."
echo "Replace directives break 'go install ...@latest'."
echo "See: https://github.com/steveyegge/gastown/issues/2230"
grep -n '^replace' go.mod
exit 1
fi
- name: Verify tag matches Version constant
run: make check-version-tag
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7
with:
distribution: goreleaser
version: '~> v2'
args: >
release --clean
${{ github.repository != 'steveyegge/gastown' && '--skip=publish --skip=announce' || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-npm:
runs-on: ubuntu-latest
needs: goreleaser
if: ${{ github.repository == 'steveyegge/gastown' }}
# npm publish is best-effort — don't fail the release if npm is down or
# the @gastown org isn't set up yet. GoReleaser + Homebrew are the primary
# distribution channels.
continue-on-error: true
permissions:
contents: read
id-token: write # OIDC token for npm trusted publishing (no NPM_TOKEN needed)
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- name: Update npm for provenance support
run: npm install -g npm@latest
- name: Publish to npm
run: |
cd npm-package
npm publish --access public --provenance