-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (44 loc) · 1.22 KB
/
release.yml
File metadata and controls
53 lines (44 loc) · 1.22 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
name: Build and Release
on:
push:
branches:
- main
jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
- name: Run tests
run: make test
- name: Create distribution builds
run: make dist
- name: Create release archives
run: make release
- name: Get version
id: get_version
run: |
VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "v0.1.0-$(date +'%Y%m%d%H%M%S')-$(git rev-parse --short HEAD)")
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ env.VERSION }}
tag_name: ${{ env.VERSION }}
generate_release_notes: true
files: |
dist/*.tar.gz
dist/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}