-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (58 loc) · 1.69 KB
/
Copy pathgithub-release.yml
File metadata and controls
71 lines (58 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Release
on:
push:
branches:
- main
paths-ignore:
- "Casks/**"
- "bucket/**"
workflow_dispatch:
permissions:
contents: write
concurrency:
group: release
cancel-in-progress: false
jobs:
release:
name: Tag and publish release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PACKAGE_MANAGER_GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Test
run: go test ./... -v -race
- name: Create next release tag
id: version
shell: bash
run: |
set -euo pipefail
latest_tag="$(git tag -l 'v*.*.*' --sort=-v:refname | head -n 1 || true)"
if [[ -z "$latest_tag" ]]; then
next_tag="v0.0.1"
else
version="${latest_tag#v}"
IFS='.' read -r major minor patch <<< "$version"
next_tag="v${major}.${minor}.$((patch + 1))"
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag "$next_tag"
git push origin "$next_tag"
echo "tag=$next_tag" >> "$GITHUB_OUTPUT"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: "v2.15.4"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.PACKAGE_MANAGER_GITHUB_TOKEN }}
PACKAGE_MANAGER_GITHUB_TOKEN: ${{ secrets.PACKAGE_MANAGER_GITHUB_TOKEN }}