32 lines (29 loc) · 1003 Bytes
/
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
name: release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
permissions:
# Allow creating GitHub release
contents: write
# Allow closing associated milestone
issues: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# Required for release notes
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Generate Release Notes
# Fetch CHANGELOG.md contents up to Git tag prior to this release, skipping top two lines
run: sed -n -e "1{/# /d;}" -e "2{/^$/d;}" -e "/# $(git describe --abbrev=0 --exclude="$(git describe --abbrev=0 --match='v*.*.*' --tags)" --match='v*.*.*' --tags | tr -d v)/q;p" CHANGELOG.md > /tmp/release-notes.txt
- uses: goreleaser/goreleaser-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: release --release-notes /tmp/release-notes.txt --rm-dist