-
Notifications
You must be signed in to change notification settings - Fork 4
192 lines (168 loc) · 6.1 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
name: Build Windows
on:
push:
branches: [ atavism/ios-migrate-desktop ]
permissions:
contents: read
env:
GOPRIVATE: github.com/getlantern
S3_BUCKET: lantern
jobs:
set-version:
runs-on:
group: large-runners
outputs:
version: ${{ steps.set-version.outputs.version }}
prefix: ${{ steps.set-version.outputs.prefix }}
version_file: ${{ steps.set-version.outputs.version_file }}
steps:
- id: set-version
shell: python
run: |
import sys, os
ref = os.environ.get("GITHUB_REF","")
if "refs/tags/lantern" not in ref:
li = 'lantern-installer-dev'
vf = 'version-android-dev.txt'
version = '9999.99.99-dev'
else:
a = ref.strip().replace('refs/tags/lantern-', '')
parts = a.split('-',1)
suffix = parts[1] if len(parts)>1 else ''
beta = 'beta' in suffix
internal = 'internal' in suffix
if beta:
li = 'lantern-installer-preview'
vf = 'version-android-beta.txt'
version = parts[0]
elif internal:
li = 'lantern-installer-internal'
vf = 'version-android-internal.txt'
version = parts[0]
else:
li = 'lantern-installer'
vf = 'version-android.txt'
version = a
print('Setting version to ' + version)
print('Setting prefix to ' + li)
print('Setting version file to ' + vf)
print(f'::set-output name=version::{version}')
print(f'::set-output name=prefix::{li}')
print(f'::set-output name=version_file::{vf}')
build-desktop:
needs: set-version
env:
version: ${{ needs.set-version.outputs.version }}
version_file: ${{ needs.set-version.outputs.version_file }}
prefix: ${{ needs.set-version.outputs.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@v3
with:
go-version: 1.21
- name: Granting private modules access
run: |
git config --global url."https://${{ secrets.GH_TOKEN }}:[email protected]/".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.dylib
run: |
CGO_ENABLED=1 CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ GOOS=windows GOARCH=386 go build -buildmode=c-shared -o desktop/liblantern.dylib desktop/lib.go
- uses: actions/upload-artifact@v3
with:
name: libgo-windows-build
if-no-files-found: error
path: |
desktop/liblantern.dylib
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
# Install Flutter
- uses: subosito/flutter-action@v2
with:
channel: "stable"
- 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@v3
with:
name: libgo-windows-build
- name: Build Flutter app
run: flutter build windows
- name: Rename file
run: ren build/windows/x64/runner/Release/androidlantern.exe lantern-installer${{inputs.installer-suffix}}.exe
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: windows${{inputs.build-suffix}}-installer-unsigned
path: lantern-installer${{inputs.installer-suffix}}.exe
sign-installer:
needs: build-windows
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@v3
with:
name: windows${{inputs.build-suffix}}-installer-unsigned
- name: Sign EXE with Azure Code Signing
uses: azure/[email protected]
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
- name: Rename file
run: ren lantern-installer-unsigned.exe lantern-installer${{inputs.installer-suffix}}.exe
- uses: actions/upload-artifact@v3
with:
name: windows${{inputs.build-suffix}}-installer-signed
path: lantern-installer${{inputs.installer-suffix}}.exe