-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (46 loc) · 1.65 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
48
49
50
51
52
53
name: Release
on:
push:
tags:
- "*"
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --force --tags
- name: Prepare
id: prep
run: |
VERSION=sha-${GITHUB_SHA::8}
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF/refs\/tags\//}
fi
RELEASE_ARGS=release
RELEASE_HEADER_TMPL=docs/releases/RELEASE_${VERSION}_HEADER.md.gotmpl
RELEASE_FOOTER_TMPL=docs/releases/RELEASE_${VERSION}_FOOTER.md.gotmpl
if [ -f "${RELEASE_HEADER_TMPL}" ]; then
RELEASE_ARGS="${RELEASE_ARGS} --release-header-tmpl=${RELEASE_HEADER_TMPL}"
else
RELEASE_ARGS="${RELEASE_ARGS} --release-header-tmpl=docs/releases/RELEASE_HEADER.md.gotmpl"
fi
if [ -f "${RELEASE_FOOTER_TMPL}" ]; then
RELEASE_ARGS="${RELEASE_ARGS} --release-footer-tmpl=${RELEASE_FOOTER_TMPL}"
else
RELEASE_ARGS="${RELEASE_ARGS} --release-footer-tmpl=docs/releases/RELEASE_FOOTER.md.gotmpl"
fi
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "RELEASE_ARGS=${RELEASE_ARGS}" >> $GITHUB_OUTPUT
- name: GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: ${{ steps.prep.outputs.RELEASE_ARGS }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}