-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (66 loc) · 2.26 KB
/
Copy pathrelease.yml
File metadata and controls
77 lines (66 loc) · 2.26 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
name: Release
on:
push:
branches: [main]
permissions:
contents: write
packages: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine next version
id: version
run: |
latest=$(git tag -l 'v*' --sort=-v:refname | head -n1)
if [ -z "$latest" ]; then
next="v0.1.0"
else
# Strip leading 'v', increment patch
base="${latest#v}"
major=$(echo "$base" | cut -d. -f1)
minor=$(echo "$base" | cut -d. -f2)
patch=$(echo "$base" | cut -d. -f3)
next="v${major}.${minor}.$((patch + 1))"
fi
echo "tag=$next" >> "$GITHUB_OUTPUT"
echo "Next version: $next"
- name: Create release tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "${{ steps.version.outputs.tag }}" -m "Release ${{ steps.version.outputs.tag }}"
git push origin "${{ steps.version.outputs.tag }}"
- uses: actions/setup-go@v5
with:
go-version: "1.24"
- name: Install debaser
run: |
tmp=$(mktemp -d)
curl -sL "https://github.com/nficano/debaser/releases/latest/download/debaser-v0.1.11-x86_64-unknown-linux-gnu.tar.gz" | tar xz -C "$tmp"
sudo mv "$tmp"/debaser-*/debaser /usr/local/bin/
rm -rf "$tmp"
- name: Generate release name
id: release-name
run: echo "name=$(debaser --sha ${{ github.sha }})" >> "$GITHUB_OUTPUT"
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
RELEASE_NAME: ${{ steps.release-name.outputs.name }}