-
Notifications
You must be signed in to change notification settings - Fork 4
280 lines (250 loc) · 9.66 KB
/
build.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
name: Build Windows
on:
push:
branches: atavism/ci-updates
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
xcode_version:
type: string
required: true
env:
GOPRIVATE: github.com/getlantern
S3_BUCKET: lantern
jobs:
build:
permissions:
contents: "read"
id-token: "write"
env:
version: ${{ inputs.version }}
prefix: ${{ inputs.prefix }}
strategy:
matrix:
include:
- os: macos-latest
platform: macos
- os: windows-latest
platform: windows
- os: ubuntu-latest
platform: android
- os: ubuntu-latest
platform: linux
#- os: macos-latest
# platform: macos
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Granting private modules access
run: git config --global url."https://${{ secrets.GH_TOKEN }}:[email protected]/".insteadOf "https://github.com/"
- name: Install WebView2 Runtime
if: matrix.platform == 'windows'
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile "MicrosoftEdgeWebView2Setup.exe"
Start-Process -FilePath ".\MicrosoftEdgeWebView2Setup.exe" -ArgumentList "/silent", "/install" -Wait
- name: Set up MinGW
if: matrix.platform == 'windows'
run: choco install mingw -y
- name: Install dependencies
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y file build-essential pkg-config
sudo apt-get install -y libwebkit2gtk-4.1-dev
sudo apt-get install -y libunwind-dev libstdc++-12-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-d cmake
sudo apt-get install -y libgtk-3-0 libblkid1 liblzma5
sudo apt-get install -y libpcap-dev libgtk-3-dev libayatana-appindicator3-dev ruby ruby-dev && sudo gem install bundler -v 2.2.26
- name: Setup Xcode
if: matrix.platform == 'macos'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ inputs.xcode_version }}
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
- run: flutter --version
- name: Setup JDK
if: matrix.platform == 'android'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: 'gradle'
- name: Set gradle properties
if: matrix.platform == 'android'
env:
GRADLE_PROPERTIES: ${{ secrets.GRADLE_PROPERTIES }}
run: |
mkdir -p ~/.gradle/
echo "GRADLE_USER_HOME=${HOME}/.gradle" >> $GITHUB_ENV
echo "${GRADLE_PROPERTIES}" > ~/.gradle/gradle.properties
- name: Decode Keystore
id: write_file
if: matrix.platform == 'android'
uses: timheuer/[email protected]
with:
fileName: 'keystore.release.jks'
fileDir: './android/app'
encodedString: ${{ secrets.KEYSTORE }}
- name: Generate app.env
env:
ANDROID_INTERSTITIAL_AD_ID: ${{ secrets.INTERSTITIAL_AD_UNIT_ID }}
IOS_INTERSTITIAL_AD_ID: ${{ secrets.INTERSTITIAL_AD_UNIT_ID_IOS }}
TAPSELL_VIDEO_INTERSTITIAL_ZONE_ID: ${{ secrets.TAPSELL_VIDEO_INTERSTITIAL_ZONE_ID }}
TAPSELL_INTERSTITIAL_ZONE_ID: ${{ secrets.TAPSELL_INTERSTITIAL_ZONE_ID }}
run: |
touch app.env
echo "Android_interstitialAd=$ANDROID_INTERSTITIAL_AD_ID" > app.env
echo "IOS_interstitialAd=$IOS_INTERSTITIAL_AD_ID" >> app.env
echo "VideoInterstitialZoneId=$TAPSELL_VIDEO_INTERSTITIAL_ZONE_ID" >> app.env
echo "InterstitialZoneId=$TAPSELL_INTERSTITIAL_ZONE_ID" >> app.env
- name: Setup protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build Lantern Library
shell: bash
run: |
touch app.env
mkdir -p "build/windows/${{inputs.arch}}/runner/Release"
make ${{matrix.platform}}
- name: Activate plugins
run: |
dart pub global activate protoc_plugin
dart pub global activate flutter_distributor
- name: Sign liblantern.dll with Azure Code Signing
if: matrix.platform == 'windows'
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
- name: Move liblantern.dll to release directory
if: matrix.platform == 'windows'
shell: bash
run: |
mv liblantern.dll "build/windows/${{inputs.arch}}/runner/Release"
- name: Extract app version from pubspec.yaml
id: extract_version
shell: bash
run: |
APP_VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //')
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
- name: Build Flutter app
run: |
New-Item -Path "./dist/${{ env.APP_VERSION }}" -ItemType Directory -Force
flutter_distributor package --platform windows --targets exe --skip-clean
env:
INTERSTITIAL_AD_UNIT: "${{ secrets.INTERSTITIAL_AD_UNIT_ID }}"
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
VERSION: "${{ env.version }}"
- name: Install darwin installer dependencies
if: matrix.platform == 'macos'
run: |
npm install -g appdmg
brew tap joshdk/tap
brew install joshdk/tap/retry
brew install imagemagick || true
- name: Build darwin installer
if: matrix.platform == 'macos'
run: |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p temporaty-password build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p temporaty-password build.keychain
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k temporaty-password build.keychain
make package-darwin
env:
VERSION: "${{ env.version }}"
MACOS_CERTIFICATE: ${{ secrets.MACOS_BNS_CERT }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_BNS_CERT_PASS }}
- name: Build installer
if: matrix.platform == 'linux'
run: |
cp liblantern.so "build/linux/${{inputs.dist-suffix}}/release/bundle"
make package-linux
mv dist/${{ env.APP_VERSION }}/lantern-${{ env.APP_VERSION }}-linux.deb lantern_${{inputs.version}}_x64.deb
mv dist/${{ env.APP_VERSION }}/lantern-${{ env.APP_VERSION }}-linux.rpm lantern_${{inputs.version}}_x64.rpm
- name: Rename installer
if: matrix.platform == 'windows'
shell: bash
run: |
mv "dist/${{ env.APP_VERSION }}/lantern-${{ env.APP_VERSION }}-windows-setup.exe" lantern-installer${{inputs.installer-suffix}}.exe
- name: Sign EXE with Azure Code Signing
if: matrix.platform == 'windows'
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,dll,msix
file-digest: SHA256
timestamp-rfc3161: http://timestamp.acs.microsoft.com
timestamp-digest: SHA256
- uses: actions/upload-artifact@v4
if: matrix.platform == 'android'
with:
name: android-apk-build
retention-days: 2
path: |
lantern-installer.apk
- name: Upload EXE artifact
uses: actions/upload-artifact@v4
if: matrix.platform == 'windows'
with:
name: windows${{inputs.build-suffix}}-installer-signed
path: |
lantern-installer${{inputs.installer-suffix}}.exe
- uses: actions/upload-artifact@v4
if: matrix.platform == 'linux'
with:
name: linux-deb-build
path: |
lantern_${{inputs.version}}_x64.deb
- uses: actions/upload-artifact@v4
if: matrix.platform == 'linux'
with:
name: linux-rpm-build
path: |
lantern_${{inputs.version}}_x64.rpm