-
Notifications
You must be signed in to change notification settings - Fork 3
314 lines (271 loc) · 9.76 KB
/
build-windows.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
name: Build Windows
on:
workflow_call:
inputs:
version:
type: string
required: true
prefix:
type: string
required: true
build-suffix: # "64" or ""
type: string
required: false
dist-suffix: # "64-bit" or "32-bit"
type: string
required: true
update-suffix: # "x64" or "386"
type: string
required: true
arch:
type: string
required: true
installer-suffix: # "-x64" or ""
type: string
required: false
env:
GOPRIVATE: github.com/getlantern
S3_BUCKET: lantern
jobs:
build-desktop:
permissions:
contents: "read"
id-token: "write"
env:
version: ${{ inputs.version }}
prefix: ${{ inputs.prefix }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Pull LFS objects
run: git lfs pull
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
- name: Granting private modules access
run: |
git config --global url."https://${{ secrets.GH_TOKEN }}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
- name: Repo access
run: |
mkdir /tmp/cache
echo "machine github.com login ${{ secrets.GH_TOKEN }} password x-oauth-basic" > /tmp/cache/.netrc
chmod 600 /tmp/cache/.netrc
- name: Setup Sentry CLI
uses: mathieu-bour/setup-sentry-cli@v1
with:
version: latest
token: ${{ SECRETS.SENTRY_TOKEN }} # from GitHub secrets
organization: getlantern
project: android
- name: Install dependencies
run: |
sudo apt-get install -y file build-essential pkg-config
sudo apt-get install -y mingw-w64 nsis
- name: Build liblantern.dll
if: ${{inputs.update-suffix == '386'}}
run: |
make windows
- name: Build liblantern.dll
if: ${{inputs.update-suffix == 'x64'}}
env:
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
VERSION: "${{ env.version }}"
run: |
make windows64
- uses: actions/upload-artifact@v4
with:
name: libgo-windows-${{inputs.update-suffix}}-build
if-no-files-found: error
path: |
liblantern.dll
- uses: actions/upload-artifact@v4
with:
name: libgo-windows-${{inputs.update-suffix}}-header
if-no-files-found: error
path: |
liblantern.h
- uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install s3cmd
run: pip install s3cmd
- name: Set s3cmd permissions
run: |
echo "[default]" > "$HOME/.s3cfg"
echo "access_key = ${{ secrets.AWS_ACCESS_KEY }}" >> "$HOME/.s3cfg"
echo "secret_key = ${{ secrets.AWS_SECRET_KEY }}" >> "$HOME/.s3cfg"
- name: Push libgo to S3
run: s3cmd put --acl-public liblantern.dll "s3://lantern/liblantern-${{inputs.update-suffix}}.dll"
build-windows:
needs: build-desktop
permissions:
contents: "read"
id-token: "write"
env:
version: ${{ inputs.version }}
prefix: ${{ inputs.prefix }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
lfs: true
# Using flutter-version-file requires yq, which is not pre-installed in windows images
- run: choco install yq
# Install Flutter
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version-file: pubspec.yaml
- run: flutter --version
- name: Setup protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Activate protoc-gen-dart plugin
run: |
dart pub global activate protoc_plugin
- name: Download the win build output
uses: actions/download-artifact@v4
with:
name: libgo-windows-${{inputs.update-suffix}}-build
- name: Download the win build output
uses: actions/download-artifact@v4
with:
name: libgo-windows-${{inputs.update-suffix}}-header
- run: make ffigen
- run: touch app.env
- name: Build Flutter app
run: flutter build windows
- name: Sign liblantern.dll with Azure Code Signing
uses: getlantern/trusted-signing-action@main
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
endpoint: https://wus2.codesigning.azure.net/
code-signing-account-name: code-signing
certificate-profile-name: Lantern
files-folder: ${{ github.workspace }}\
files-folder-filter: dll
file-digest: SHA256
timestamp-rfc3161: http://timestamp.acs.microsoft.com
timestamp-digest: SHA256
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: windows${{inputs.build-suffix}}-build-signed
path: |
liblantern.dll
- name: Create archive
run: |
ls build/windows
cp liblantern.dll "build/windows/${{inputs.arch}}/runner/Release"
Compress-Archive "build/windows/${{inputs.arch}}/runner/Release" lantern.zip
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: windows${{inputs.build-suffix}}-build
path: lantern.zip
build-installer:
needs: build-windows
permissions:
contents: "read"
id-token: "write"
env:
version: ${{ inputs.version }}
prefix: ${{ inputs.prefix }}
runs-on: ubuntu-20.04
steps:
- name: Install dependencies
run: |
sudo apt-get install -y file build-essential pkg-config
sudo apt-get install -y mingw-w64 nsis
- uses: actions/checkout@v3
- uses: actions/download-artifact@v4
with:
name: windows${{inputs.build-suffix}}-build
- name: Make installer
run: |
pwd
unzip lantern.zip
cp installer-resources-lantern/.packaged-lantern.yaml installer-resources-lantern/windows/.packaged-lantern.yaml
cp installer-resources-lantern/lantern.yaml installer-resources-lantern/windows/lantern.yaml
cp -r Release/* installer-resources-lantern/windows
makensis -V1 -DVERSION=${{ inputs.version }} -DAPP_NAME=lantern.exe -DOUT_FILE="lantern-installer${{inputs.installer-suffix}}.exe" installer-resources-lantern/windows/lantern.nsi
mv installer-resources-lantern/windows/lantern-installer${{inputs.installer-suffix}}.exe lantern-installer${{inputs.installer-suffix}}.exe
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: windows${{inputs.build-suffix}}-installer-unsigned
path: lantern-installer${{inputs.installer-suffix}}.exe
sign-installer:
needs: build-installer
permissions:
contents: "read"
id-token: "write"
env:
version: ${{ inputs.version }}
prefix: ${{ inputs.prefix }}
runs-on: windows-latest
steps:
- name: Download the win build output
uses: actions/download-artifact@v4
with:
name: windows${{inputs.build-suffix}}-installer-unsigned
- name: Sign EXE with Azure Code Signing
uses: getlantern/trusted-signing-action@main
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
endpoint: https://wus2.codesigning.azure.net/
code-signing-account-name: code-signing
certificate-profile-name: Lantern
files-folder: ${{ github.workspace }}\
files-folder-filter: exe
file-digest: SHA256
timestamp-rfc3161: http://timestamp.acs.microsoft.com
timestamp-digest: SHA256
- uses: actions/upload-artifact@v4
with:
name: windows${{inputs.build-suffix}}-installer-signed
path: |
lantern-installer${{inputs.installer-suffix}}.exe
upload-windows:
needs: sign-installer
permissions:
contents: "read"
id-token: "write"
env:
version: ${{ inputs.version }}
prefix: ${{ inputs.prefix }}
runs-on: ubuntu-20.04
steps:
- name: Download the artifact
uses: actions/download-artifact@v4
with:
name: windows${{inputs.build-suffix}}-installer-signed
- name: Install s3cmd
run: pip install s3cmd
- name: Set s3cmd permissions
run: |
echo "[default]" > "$HOME/.s3cfg"
echo "access_key = ${{ secrets.AWS_ACCESS_KEY }}" >> "$HOME/.s3cfg"
echo "secret_key = ${{ secrets.AWS_SECRET_KEY }}" >> "$HOME/.s3cfg"
- name: Push binaries to s3
env:
VERSION: "${{ inputs.version }}"
dist_versionless: "${{inputs.prefix}}-${{inputs.dist-suffix}}.exe"
dist: "${{inputs.prefix}}-${{inputs.version}}-${{inputs.dist-suffix}}.exe"
update: "lantern_update_windows_${{inputs.update-suffix}}-${{inputs.version}}.bz2"
run: |
ls -l
cat lantern.exe | bzip2 > ${{ env.update }}
mv lantern-installer${{inputs.installer-suffix}}.exe ${{ env.dist }}
shasum -a 256 ${{ env.dist }} | cut -d " " -f 1 > ${{ env.dist }}.sha256
shasum -a 256 ${{ env.update }} | cut -d " " -f 1 > ${{ env.update }}.sha256
ls -l
s3cmd put --acl-public ${{ env.dist }} ${{ env.update }} ${{ env.update }}.sha256 ${{ env.dist }}.sha256 "s3://lantern"