-
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (43 loc) · 1.5 KB
/
Copy pathrelease.yml
File metadata and controls
50 lines (43 loc) · 1.5 KB
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
name: Release
on:
push:
tags:
- 'v*.*.*'
# Workflow default is read-only. Only the release job needs write access to
# create the GitHub Release, and that is granted per-job below.
permissions:
contents: read
jobs:
release:
name: Create GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write # required by `gh release create` to publish the release
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Verify build
run: go build ./...
- name: Run tests
run: go test -race ./...
- name: Create Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Idempotent: if the maintainer already published the release
# manually (with curated notes from CHANGELOG.md), skip the
# auto-generated fallback. Otherwise create it so tags pushed
# directly never lack a published release.
if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
echo "Release ${GITHUB_REF_NAME} already exists — leaving the maintainer-curated notes in place."
exit 0
fi
gh release create "${GITHUB_REF_NAME}" \
--title "${GITHUB_REF_NAME}" \
--generate-notes \
--verify-tag