-
Notifications
You must be signed in to change notification settings - Fork 7
64 lines (56 loc) · 1.95 KB
/
release.yml
File metadata and controls
64 lines (56 loc) · 1.95 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
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Unshallow repo
run: git fetch --prune --unshallow
- name: Go
uses: actions/setup-go@v4
with:
go-version: "1.24.5"
- name: Go Dependency
run: go mod tidy
- name: Env
id: vars
run: |
printf "Using go at: $(which go)\n"
printf "Go version: $(go version)\n"
printf "\n\nGo environment:\n\n"
go env
printf "\n\nSystem environment:\n\n"
env
echo "name=version_tag::${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
echo "name=short_sha::$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "name=go_cache::$(go env GOCACHE)" >> $GITHUB_OUTPUT
# Parse semver
TAG=${GITHUB_REF/refs\/tags\//}
SEMVER_RE='[^0-9]*\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\([0-9A-Za-z\.-]*\)'
TAG_MAJOR=`echo ${TAG#v} | sed -e "s#$SEMVER_RE#\1#"`
TAG_MINOR=`echo ${TAG#v} | sed -e "s#$SEMVER_RE#\2#"`
TAG_PATCH=`echo ${TAG#v} | sed -e "s#$SEMVER_RE#\3#"`
TAG_SPECIAL=`echo ${TAG#v} | sed -e "s#$SEMVER_RE#\4#"`
echo "name=tag_major::${TAG_MAJOR}" >> $GITHUB_OUTPUT
echo "name=tag_minor::${TAG_MINOR}" >> $GITHUB_OUTPUT
echo "name=tag_patch::${TAG_PATCH}" >> $GITHUB_OUTPUT
echo "name=tag_special::${TAG_SPECIAL}" >> $GITHUB_OUTPUT
# GoReleaser will take care of publishing those artifacts into the release
- name: GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ steps.vars.outputs.version_tag }}