-
Notifications
You must be signed in to change notification settings - Fork 63
47 lines (44 loc) · 1.31 KB
/
release.yml
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
name: goreleaser
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # Only build tag with semantic versioning format
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+'
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
cache: true
- name: Set release tag env variable
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set the current version as env variable
run: |
make build
echo "CURRENT_VERSION=$(./dblab version)" >> $GITHUB_ENV
- name: Test the env variables
run: |
echo RELEASE_VERSION
echo ${{ env.RELEASE_VERSION }}
echo CURRENT_VERSION
echo ${{ env.CURRENT_VERSION }}
- name: Run GoReleaser
if: env.RELEASE_VERSION == env.CURRENT_VERSION
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: release -f .goreleaser.yaml --clean
env:
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}