-
Notifications
You must be signed in to change notification settings - Fork 39
57 lines (53 loc) · 1.74 KB
/
Copy pathrelease.yml
File metadata and controls
57 lines (53 loc) · 1.74 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
name: Release
on:
workflow_dispatch:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
check-version-file:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Get tag version
id: tag
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Get file version
id: file
run: echo "version=$(cat version/VERSION)" >> $GITHUB_OUTPUT
- name: Compare versions
run: |
if [ "${{ steps.tag.outputs.version }}" != "${{ steps.file.outputs.version }}" ]; then
echo "Tag version (${{ steps.tag.outputs.version }}) does not match file version (${{ steps.file.outputs.version }})"
exit 1
fi
echo "Version check passed: ${{ steps.tag.outputs.version }}"
goreleaser:
needs: check-version-file
runs-on: ubuntu-latest
env:
flags: ""
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Determine Go version
id: go
uses: ./.github/actions/go-version
- name: Set up Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: ${{ steps.go.outputs.version }}
cache: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
with:
distribution: goreleaser
version: "~> v2"
args: release --clean ${{ env.flags }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}