-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (83 loc) · 2.28 KB
/
release.yaml
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
lint:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- 'windows-latest'
go-version:
- '1.22.x'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --timeout=30m
release:
runs-on: ${{ matrix.os }}
needs: lint
strategy:
matrix:
os:
- 'ubuntu-latest'
- 'windows-latest'
- 'macos-latest'
go-version:
- '1.22.x'
# List of GOOS and GOARCH pairs from `go tool dist list`
goosarch:
- linux/amd64
- linux/arm64
- windows/amd64
- windows/arm64
- darwin/amd64
- darwin/arm64
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Display Go version
run: go version
- name: Get OS and arch info
run: |
GOOSARCH=${{ matrix.goosarch }}
GOOS=${GOOSARCH%/*}
GOARCH=${GOOSARCH#*/}
BINARY_NAME=$(basename $GITHUB_REPOSITORY)-$GOOS-$GOARCH
echo "BINARY_NAME=$BINARY_NAME" | tee -a $GITHUB_ENV
echo "GOOS=$GOOS" | tee -a $GITHUB_ENV
echo "GOARCH=$GOARCH" | tee -a $GITHUB_ENV
- name: Build
run: |
go build -o "$BINARY_NAME" -v -ldflags "-H windowsgui -s -w"
- name: Release Notes
run:
git log $(git describe HEAD~ --tags --abbrev=0)..HEAD --pretty='format:* %h %s%n * %an <%ae>' --no-merges >> ".github/RELEASE-TEMPLATE.md"
- name: Release with Notes
uses: softprops/action-gh-release@v1
with:
body_path: ".github/RELEASE-TEMPLATE.md"
draft: false
files: ${{ env.BINARY_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}