-
Notifications
You must be signed in to change notification settings - Fork 20
82 lines (71 loc) · 1.91 KB
/
publish-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
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
78
79
80
81
82
name: Publish release
on:
workflow_dispatch:
inputs:
version:
description: >-
Version to release (e.g. v1.2.3).
Uses latest version from changelog if unset.
default: ''
type: string
ref:
description: Git ref to release from.
required: true
type: string
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
token: ${{ secrets.PAT }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
- name: Query changie
if: inputs.version == ''
id: changie-latest
uses: miniscruff/changie-action@v2
with:
args: latest
- name: Set version (changie)
if: inputs.version == ''
run:
echo "VERSION=${CHANGIE_VERSION#v}" >> "$GITHUB_ENV"
env:
CHANGIE_VERSION: ${{ steps.changie-latest.outputs.output }}
- name: Set version (input)
if: inputs.version != ''
run:
echo "VERSION=${INPUT_VERSION#v}" >> "$GITHUB_ENV"
env:
INPUT_VERSION: ${{ inputs.version }}
- name: Verify version
run: |
if [[ -z "$VERSION" ]]; then
echo "No version set"
exit 1
fi
- name: Extract changelog
run: |
tail -n+2 .changes/v${{ env.VERSION }}.md \
| tee ${{ github.workspace }}-CHANGELOG.txt
- name: Tag a release
run: |
git tag "$TAG"
git push origin "$TAG"
env:
TAG: v${{ env.VERSION }}
- name: Release
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean --release-notes ${{ github.workspace }}-CHANGELOG.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: v${{ env.VERSION }}