-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (54 loc) · 1.52 KB
/
Copy pathrelease.yml
File metadata and controls
64 lines (54 loc) · 1.52 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
tag:
description: release tag like v0.1.0
required: true
type: string
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: resolve release tag
id: meta
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
fi
- uses: actions/checkout@v4
with:
ref: refs/tags/${{ steps.meta.outputs.tag }}
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: verify version
run: |
version="$(tr -d '\n' < VERSION)"
tag="${{ steps.meta.outputs.tag }}"
release_version="${tag#v}"
test "$version" = "$release_version"
- name: check formatting
run: test -z "$(gofmt -l ./cmd ./internal)"
- name: run tests
run: go test ./...
- name: build release archives
run: |
release_version="${{ steps.meta.outputs.tag }}"
sh ./scripts/build-release.sh "${release_version#v}"
- name: publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.meta.outputs.tag }}
generate_release_notes: true
files: |
dist/*.tar.gz
dist/checksums.txt