-
Notifications
You must be signed in to change notification settings - Fork 1
130 lines (115 loc) · 4.7 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'version.txt'
name: Release
jobs:
build:
name: Release
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16+
uses: actions/setup-go@v2
with:
go-version: ^1.17
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::$(cat version.txt)
- name: Get commit hash
id: get_commit_hash
run: echo ::set-output name=COMMIT_HASH::$(git rev-parse --short HEAD)
- name: Get tag name
id: get_tag_name
uses: haya14busa/action-cond@v1
with:
cond: ${{ github.ref == 'refs/heads/main' }}
if_true: ${{ steps.get_version.outputs.VERSION }}
if_false: ${{ steps.get_version.outputs.VERSION }}-${{ steps.get_commit_hash.outputs.COMMIT_HASH }}-dev
- name: Build all binaries and zips
run: make release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_tag_name.outputs.value }}
release_name: Release ${{ steps.get_tag_name.outputs.value }}
draft: false
prerelease: ${{ github.ref != 'refs/heads/main' }}
- name: Upload x64 Linux Release Binary
id: upload-release-binary-linux-amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/linux-amd64/pryrite
asset_name: pryrite-linux-amd64
asset_content_type: application/octet-stream
- name: Upload x64 Linux Release Asset
id: upload-release-asset-linux-amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./zips/pryrite-linux-amd64.zip
asset_name: pryrite-linux-amd64-${{ steps.get_tag_name.outputs.value }}.zip
asset_content_type: application/zip
- name: Upload ARM-64 Linux Release Binary
id: upload-release-binary-linux-arm64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/linux-arm64/pryrite
asset_name: pryrite-linux-arm64
asset_content_type: application/octet-stream
- name: Upload ARM-64 Linux Release Asset
id: upload-release-asset-linux-arm64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./zips/pryrite-linux-arm64.zip
asset_name: pryrite-linux-arm64-${{ steps.get_tag_name.outputs.value }}.zip
asset_content_type: application/zip
- name: Upload ARM-32 Linux Release Binary
id: upload-release-binary-linux-arm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/linux-arm/pryrite
asset_name: pryrite-linux-arm
asset_content_type: application/octet-stream
- name: Upload ARM-32 Linux Release Asset
id: upload-release-asset-linux-arm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./zips/pryrite-linux-arm.zip
asset_name: pryrite-linux-arm-${{ steps.get_tag_name.outputs.value }}.zip
asset_content_type: application/zip
- name: Upload darwin Release Asset
id: upload-release-asset-darwin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./zips/pryrite-darwin-amd64.zip
asset_name: pryrite-darwin-amd64-${{ steps.get_tag_name.outputs.value }}.zip
asset_content_type: application/zip