-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (44 loc) · 1.1 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
name: Create release
on:
push:
tags:
- v*
permissions:
contents: write
jobs:
release:
name: Release pushed tag
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Compile go binary
env:
CGO_ENABLED: 0
GOOS: linux
GOARCH: amd64
run: |
mkdir -p dist
go build \
-ldflags="-s -w -extldflags '-static'" \
-o dist/
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="$tag" \
--generate-notes \
-d
- name: Upload assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release upload "$tag" dist/* --repo="$GITHUB_REPOSITORY"