-
Notifications
You must be signed in to change notification settings - Fork 12
337 lines (290 loc) · 11.3 KB
/
release-binaries.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
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
name: Release binaries
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
env:
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
WAILS_VERSION: v2.4.1
NODE_VERSION: 18.12.0
GO_VERSION: 1.20.6
jobs:
release-macos:
name: Release ${{ matrix.network }} on MacOS ${{ matrix.arch }}
runs-on: macos-latest
strategy:
matrix:
arch:
- amd64
- arm64
network:
- mainnet
- fairground
include:
- network: mainnet
software-name: Vega Wallet
filename: vega-wallet
- network: fairground
software-name: Fairground Wallet
filename: fairground-wallet
- arch: amd64
user-friendly-arch: intel
- arch: arm64
user-friendly-arch: apple-silicon
steps:
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
id: npm
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Get Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@${{ env.WAILS_VERSION }}
- name: Check out repository
uses: actions/checkout@v3
- name: Prepare "${{ matrix.network }}" bundle
shell: bash
env:
WALLET_OPTIMIZED_FOR: ${{ matrix.network }}
run: ./prepare.sh
- name: Build binary
env:
VITE_FEATURE_MODE: ${{ matrix.network }}
run: wails build -clean -f -platform=darwin/${{ matrix.arch }} -tags ${{ matrix.network }}
- name: Run tests
if: ${{ matrix.arch == 'amd64' }}
run: go test -v ./...
- name: Import DeveloperID Certificate
uses: apple-actions/import-codesign-certs@v1
with:
keychain: vega
create-keychain: true
p12-file-base64: ${{ secrets.MACOS_CERTIFICATE }}
p12-password: ${{ secrets.MACOS_CERTIFICATE_PASS }}
- name: Sign binary
working-directory: build/bin
# --timestamp
# During signing, requests that a timestamp authority server be contacted to authenticate the time of
# signing.
# --deep
# When signing a bundle, specifies that nested code content such as helpers, frameworks, and plug-ins,
# should be recursively signed in turn.
# --options runtime
# On macOS versions >= 10.14.0, opts signed processes into a hardened runtime environment which includes
# runtime code signing enforcement, library validation, hard, kill, and debugging restrictions.
run: codesign --verbose --sign "${{ secrets.MACOS_CERTIFICATE_IDENTITY_ID }}" --timestamp --options runtime --deep --force "${{ matrix.software-name }}.app"
- name: Verify signature
working-directory: build/bin
run: codesign --verbose --verify --strict --deep "${{ matrix.software-name }}.app"
- name: Bundle binary for notarization
working-directory: build/bin
run: /usr/bin/ditto -c -k --keepParent "${{ matrix.software-name }}.app" "${{ matrix.filename }}-desktop-macos-${{ matrix.user-friendly-arch }}.zip"
- name: Store notarization credentials
run: |
xcrun notarytool store-credentials vega \
--apple-id "${{ secrets.MACOS_NOTARIZATION_APPLE_ID }}" \
--team-id "${{ secrets.MACOS_NOTARIZATION_TEAM_ID }}" \
--password "${{ secrets.MACOS_NOTARIZATION_PASS }}"
- name: Notarize app
working-directory: build/bin
run: |
xcrun notarytool submit "${{ matrix.filename }}-desktop-macos-${{ matrix.user-friendly-arch }}.zip" \
--keychain-profile vega \
--output-format json \
--timeout "90m" \
--wait
- name: Staple app
working-directory: build/bin
run: xcrun stapler staple "${{ matrix.software-name }}.app"
- name: Delete old archive
working-directory: build/bin
run: rm -rf ${{ matrix.filename }}-desktop-macos-${{ matrix.user-friendly-arch }}.zip
- name: Bundle binary in archive for distribution
working-directory: build/bin
run: /usr/bin/ditto -c -k --keepParent "${{ matrix.software-name }}.app" "${{ matrix.filename }}-desktop-macos-${{ matrix.user-friendly-arch }}.zip"
- name: Release
uses: softprops/action-gh-release@v1
with:
files: build/bin/*.zip
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-windows:
name: Release ${{ matrix.network }} on Windows ${{ matrix.arch }}
runs-on: windows-2019
strategy:
matrix:
arch:
- amd64
- arm64
network:
- mainnet
- fairground
include:
- network: mainnet
software-name: Vega Wallet
filename: vega-wallet
- network: fairground
software-name: Fairground Wallet
filename: fairground-wallet
steps:
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
id: npm
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Get Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@${{ env.WAILS_VERSION }}
- name: Check out repository
uses: actions/checkout@v3
- name: Prepare "${{ matrix.network }}" bundle
shell: bash
env:
WALLET_OPTIMIZED_FOR: ${{ matrix.network }}
run: ./prepare.sh
- name: Build binary
env:
VITE_FEATURE_MODE: ${{ matrix.network }}
run: wails build -f -platform=windows/${{ matrix.arch }} -tags ${{ matrix.network }}
- name: Run tests
if: ${{ matrix.arch == 'amd64' }}
run: go test -v ./...
- name: Import signing certificate
run: |
echo "${{ secrets.EV_SIGN_CERT_FULL_CHAIN_PEM }}" > certificate_chain.pem
- name: "Download Java v17"
uses: oracle-actions/setup-java@v1
with:
website: oracle.com
release: 17
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Export gcloud related env variable
run: export CLOUDSDK_PYTHON="/usr/bin/python3"
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
- name: 'Use gcloud CLI'
run: 'gcloud info'
- name: Download signing tool and verify sha265 checksum
shell: bash
run: |
curl -L -o jsign.jar "https://github.com/ebourg/jsign/releases/download/4.2/jsign-4.2.jar"
echo '290377fc4f593256200b3ea4061b7409e8276255f449d4c6de7833faf0850cc1 jsign.jar' | sha256sum -c
# We sign binaries with the EV Certificate. You MUST NOT have a key in a file to sign binary.
# The only options to store keys are:
# - HSM architecture(e.g., AWS or Google)
# - Physical USB stick with hardware stored key
# We are using the first option to be able to sign the binaries within the CI servers without
# physical access to them. However, this signing method requires the signing tool supporting the HSM key.
#
# The high-level signing procedure looks like below:
# 1. Calculate the SHA256 Hash for the app
# 2. Send a request to sign the hash to the Google Cloud
# 3. Google signs our signature with a physically stored key on Google's HSM server and returns the signature over the network
# 4. Add our certificate and the signature received from the Google HSM to the EXE file
# 5. Our signature hash is again signed with the timestamp authority's private key, and the final hash is added to our binary.
# 6. Final executable with all necessary signing information included is produced
- name: Sign binary
shell: bash
run: |
cd build/bin && \
java -jar ../../jsign.jar \
--storetype GOOGLECLOUD \
--storepass "$(gcloud auth print-access-token)" \
--keystore "projects/vegaprotocol/locations/europe-west2/keyRings/windows-sign-apps" \
--alias "digicert-ev-signing-key-ecc-256" \
--certfile "../../certificate_chain.pem" \
--tsmode RFC3161 \
--tsaurl http://timestamp.globalsign.com/tsa/r6advanced1 \
"${{ matrix.software-name }}.exe"
- name: Prepare binaries for release
shell: bash
run: |
mkdir -p build/release-bin;
cd build/bin;
cp "${{ matrix.software-name }}.exe" "../release-bin/${{ matrix.filename }}-desktop-windows-${{ matrix.arch }}.exe"
ls -als ../release-bin/*.exe
- name: Release
uses: softprops/action-gh-release@v1
with:
files: build/release-bin/*.exe
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-linux:
name: Release ${{ matrix.network }} on Linux ${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- amd64
network:
- mainnet
- fairground
include:
- network: mainnet
software-name: Vega Wallet
filename: vega-wallet
- network: fairground
software-name: Fairground Wallet
filename: fairground-wallet
steps:
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
id: npm
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Check out repository
uses: actions/checkout@v3
- name: Install Wails dependencies
run: |
sudo apt-get update
sudo apt-get install build-essential libgtk-3-dev libwebkit2gtk-4.0-dev
- name: Get Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@${{ env.WAILS_VERSION }}
- name: Prepare "${{ matrix.network }}" bundle
shell: bash
env:
WALLET_OPTIMIZED_FOR: ${{ matrix.network }}
run: ./prepare.sh
- name: Build binary
env:
VITE_FEATURE_MODE: ${{ matrix.network }}
run: wails build -clean -f -platform=linux/${{ matrix.arch }} -tags ${{ matrix.network }}
- name: Run tests
if: ${{ matrix.arch == 'amd64' }}
run: go test -v ./...
- name: Bundle binary in archive
uses: thedoctor0/zip-release@master
with:
type: zip
directory: build/bin
filename: ${{ matrix.filename }}-desktop-linux-${{ matrix.arch }}.zip
- name: Release
uses: softprops/action-gh-release@v1
with:
files: build/bin/*.zip
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}