-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (84 loc) · 3.41 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
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
97
98
99
100
name: Release
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.16
- name: Get the version
id: get_version
run: echo "VERSION=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null)" >> $GITHUB_ENV
- name: Generate release notes
id: release_notes
run: |
echo 'Release Notes' > RELEASE_NOTES.md
echo '' >> RELEASE_NOTES.md
git log --pretty=format:"- %s" >> RELEASE_NOTES.md
echo "body=$(cat RELEASE_NOTES.md | base64)" >> $GITHUB_ENV
- name: Bump version and push tag
id: bump_version
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}
WITH_V: true
DEFAULT_BUMP: minor
- name: Build Linux release
run: |
GOOS=linux GOARCH=amd64 go build -v -ldflags "-X main.version=${{ steps.bump_version.outputs.new_tag }}" -o bin/shadowguard-linux ./cmd
- name: Build macOS release
run: |
GOOS=darwin GOARCH=amd64 go build -v -ldflags "-X main.version=${{ steps.bump_version.outputs.new_tag }}" -o bin/shadowguard-macos ./cmd
- name: Build Windows release
run: |
GOOS=windows GOARCH=amd64 go build -v -ldflags "-X main.version=${{ steps.bump_version.outputs.new_tag }}" -o bin/shadowguard.exe ./cmd
- name: Print new version
run: echo "The new version is ${{ steps.bump_version.outputs.new_tag }}"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}
with:
tag_name: ${{ steps.bump_version.outputs.new_tag }}
release_name: Release ${{ steps.bump_version.outputs.new_tag }}
body: ${{ steps.run_script.outputs.stdout }}
draft: false
prerelease: false
- name: Upload Linux Asset
id: upload_linux_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/shadowguard-linux
asset_name: shadowguard-linux-${{ steps.bump_version.outputs.new_tag }}
asset_content_type: application/octet-stream
- name: Upload macOS Asset
id: upload_macos_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/shadowguard-macos
asset_name: shadowguard-macos-${{ steps.bump_version.outputs.new_tag }}
asset_content_type: application/octet-stream
- name: Upload Windows Asset
id: upload_windows_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/shadowguard.exe
asset_name: shadowguard-windows-${{ steps.bump_version.outputs.new_tag }}.exe
asset_content_type: application/octet-stream