-
Notifications
You must be signed in to change notification settings - Fork 8
72 lines (64 loc) · 1.72 KB
/
release.yaml
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
name: Release 🚀
on:
workflow_dispatch:
inputs:
semver:
type: string
required: true
description: 'Semver for release. (e.g. 0.0.1) Not prefix v!'
jobs:
create-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Try to update inline versions
run: |
make update-versions VERSION=${SEMVER}
env:
SEMVER: ${{ github.event.inputs.semver }}
- name: Check Diff
id: diff
run: |
git add -N .
git diff --name-only --exit-code
continue-on-error: true
- name: Commit & Push
if: steps.diff.outcome == 'failure'
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git add .
git commit --author=. -m 'Auto Update by Release Action'
git push
- name: Create tag
run: |
git tag ${GIT_TAG}
git push origin ${GIT_TAG}
env:
GIT_TAG: v${{ github.event.inputs.semver }}
create-release:
runs-on: ubuntu-latest
needs: create-tag
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- run: go version
- name: GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}