-
Notifications
You must be signed in to change notification settings - Fork 31
184 lines (184 loc) · 6.58 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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# This workflow creates a release and builds and uploads
# a debian package, as well as linux, windows and mac binaries.
#
# Trigger this workflow by pushing a version tag e.g. v1.1.0.
# Add -rc or -rcN for a release candidate/ prerelease e.g. v1.1.0-rc or v1.1.0-rc1.
name: Release
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
buildDeb:
runs-on: ubuntu-latest
outputs:
version: ${{ env.VERS }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install latest version of go
uses: actions/setup-go@v5
with:
go-version: 1.x
- name: Make sf and roy binaries
run: |
go install github.com/richardlehane/siegfried/cmd/sf
go install github.com/richardlehane/siegfried/cmd/roy
env:
CGO_ENABLED: 0
- name: Set environment variables # trim refs/tags/v using 'cut -c12-'
run: |
VERSION=$(echo "${{ github.ref }}" | cut -c12-)
echo "VERS=$(echo $VERSION | tr . -)" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "SF_PATH=siegfried_$VERSION-1_amd64" >> $GITHUB_ENV
echo "BIN_PATH=$(go env GOPATH)/bin" >> $GITHUB_ENV
- name: Execute debbuilder script
run: (chmod +x debbuilder.sh && ./debbuilder.sh)
- name: Zip executables
run: zip -j siegfried_${{ env.VERS }}_linux64.zip ${{ env.BIN_PATH }}/sf ${{ env.BIN_PATH }}/roy
- name: Make self-contained sf binary
run: go install -tags static github.com/richardlehane/siegfried/cmd/sf
env:
CGO_ENABLED: 0
- name: Zip self-contained executable
run: zip -j siegfried_${{ env.VERS }}_linux64_static.zip ${{ env.BIN_PATH }}/sf
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-artifacts
path: |
${{ env.SF_PATH }}.deb
siegfried_${{ env.VERS }}_linux64.zip
siegfried_${{ env.VERS }}_linux64_static.zip
buildMac:
runs-on: macos-latest
needs: buildDeb
env:
VERSION: ${{needs.buildDeb.outputs.version}}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install latest version of go
uses: actions/setup-go@v5
with:
go-version: 1.x
- name: Make sf and roy binaries
run: |
go install github.com/richardlehane/siegfried/cmd/sf
go install github.com/richardlehane/siegfried/cmd/roy
- name: Zip executables
run: zip -j siegfried_${{ env.VERSION }}_mac64.zip $(go env GOPATH)/bin/sf $(go env GOPATH)/bin/roy
- name: Make self-contained sf binary
run: go install -tags static github.com/richardlehane/siegfried/cmd/sf
- name: Zip self-contained executable
run: zip -j siegfried_${{ env.VERSION }}_mac64_static.zip $(go env GOPATH)/bin/sf
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: |
siegfried_${{ env.VERSION }}_mac64.zip
siegfried_${{ env.VERSION }}_mac64_static.zip
buildWin:
runs-on: windows-latest
needs: buildDeb
env:
VERSION: ${{needs.buildDeb.outputs.version}}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install latest version of go
uses: actions/setup-go@v5
with:
go-version: 1.x
- name: Make sf and roy binaries
run: |
go install github.com/richardlehane/siegfried/cmd/sf
go install github.com/richardlehane/siegfried/cmd/roy
- name: Zip assets
shell: pwsh
run: |
7z a siegfried_${{ env.VERSION }}_win64.zip ((go env GOPATH) + "\bin\*.exe")
md siegfried
Copy-Item cmd\roy\data\* siegfried -recurse
7z a data_${{ env.VERSION }}.zip siegfried
- name: Make self-contained sf binary
run: go install -tags static github.com/richardlehane/siegfried/cmd/sf
- name: Zip static binary
shell: pwsh
run: 7z a siegfried_${{ env.VERSION }}_win64_static.zip ((go env GOPATH) + "\bin\sf.exe")
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-artifacts
path: |
siegfried_${{ env.VERSION }}_win64.zip
siegfried_${{ env.VERSION }}_win64_static.zip
data_${{ env.VERSION }}.zip
buildWin7:
runs-on: windows-latest
needs: buildDeb
env:
VERSION: ${{needs.buildDeb.outputs.version}}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install latest version of go
uses: actions/setup-go@v5
with:
go-version: 1.20
- name: Make sf and roy binaries
run: |
go install github.com/richardlehane/siegfried/cmd/sf
go install github.com/richardlehane/siegfried/cmd/roy
- name: Zip binaries
shell: pwsh
run: |
7z a siegfried_${{ env.VERSION }}_win7.zip ((go env GOPATH) + "\bin\*.exe")
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-artifacts
path: |
siegfried_${{ env.VERSION }}_win7.zip
buildWasm:
runs-on: ubuntu-latest
needs: buildDeb
env:
VERSION: ${{needs.buildDeb.outputs.version}}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install latest version of go
uses: actions/setup-go@v5
with:
go-version: 1.x
- name: Make sf.wasm
run: |
GOOS=js GOARCH=wasm go build -o sf.wasm github.com/richardlehane/siegfried/wasm
- name: Zip wasm
run: zip -j siegfried_${{ env.VERSION }}_wasm.zip sf.wasm
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: |
siegfried_${{ env.VERSION }}_wasm.zip
createRelease:
runs-on: ubuntu-latest
needs: [buildMac, buildWin, buildWin7]
steps:
- name: Set version
run: echo "VERSION=$(echo "${{ github.ref }}" | cut -c12-)" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
with:
name: release-artifacts
path: release-artifacts
- name: Create release
uses: softprops/action-gh-release@v2
with:
name: Version ${{ env.VERSION }}
prerelease: ${{ contains(github.ref, 'rc') }}
body: see CHANGELOG.md
files: release-artifacts/*