-
Notifications
You must be signed in to change notification settings - Fork 3
80 lines (67 loc) · 1.81 KB
/
Copy pathrelease.yml
File metadata and controls
80 lines (67 loc) · 1.81 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
name: Release
on:
push:
tags: ["v*.*.*"]
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
env:
GO_VERSION: "1.25.x"
jobs:
test:
name: Pre-Release Test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: go.sum
- name: Verify modules
run: go mod verify
- name: Test
run: go test -race -timeout 5m ./...
- name: Validate tag version
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG="${GITHUB_REF#refs/tags/}"
if ! [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
echo "❌ Invalid semver tag: $TAG"
exit 1
fi
echo "✅ Valid tag: $TAG"
release:
name: Build & Release
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: go.sum
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean --timeout 60m
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify release assets
run: |
echo "🔍 Release assets:"
ls -lh dist/*.tar.gz dist/*.zip 2>/dev/null || true
echo ""
echo "📋 Checksums:"
cat dist/*_checksums.txt 2>/dev/null || echo "No checksums found"