-
Notifications
You must be signed in to change notification settings - Fork 4
215 lines (196 loc) · 8.47 KB
/
release.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
name: Publish releases
on:
# Triggers the workflow on push when pushing to a version tag
push:
tags:
- '*lantern-*'
workflow_run:
workflows: [ "go" ]
types:
- completed
workflow_dispatch:
permissions:
contents: "read"
id-token: "write"
env:
GOPRIVATE: github.com/getlantern
S3_BUCKET: lantern
jobs:
determine-platform:
runs-on: ubuntu-latest
outputs:
platform: ${{ steps.set-platform.outputs.platform }}
steps:
- name: Determine Platform
id: set-platform
run: |
echo "GITHUB_REF is: $GITHUB_REF"
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
echo "Tag is: $TAG"
if [[ $TAG == ios-* ]]; then
echo "Platform determined: ios"
echo "platform=ios" >> "$GITHUB_OUTPUT"
elif [[ $TAG == android-* ]]; then
echo "Platform determined: android"
echo "platform=android" >> "$GITHUB_OUTPUT"
elif [[ $TAG == desktop-* ]]; then
echo "Platform determined: macos"
echo "platform=desktop" >> "$GITHUB_OUTPUT"
else
echo "Platform determined: all (tag did not match specific platforms)"
echo "platform=all" >> "$GITHUB_OUTPUT"
fi
else
echo "Not a tag reference, defaulting to all platforms"
echo "platform=all" >> "$GITHUB_OUTPUT"
fi
set-version:
needs: determine-platform
runs-on: ubuntu-latest
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:
uses: ./.github/workflows/build.yml
secrets: inherit
needs: set-version
with:
macos_version: macos-14
xcode_version: latest-stable
version: ${{ needs.set-version.outputs.version }}
version_file: ${{ needs.set-version.outputs.version_file }}
prefix: ${{ needs.set-version.outputs.prefix }}
build-suffix: 64
dist-suffix: x64
installer-suffix: -x64
windows-arch: x64
push-binaries:
runs-on: ubuntu-latest
needs: [ set-version, build ]
env:
version: ${{ needs.set-version.outputs.version }}
prefix: ${{ needs.set-version.outputs.prefix }}
steps:
- name: Download the mac build output
uses: actions/download-artifact@v4
with:
name: macos-build
- name: Download the linux deb build output
uses: actions/download-artifact@v4
with:
name: linux-rpm-build
- name: Download the linux rpm build output
uses: actions/download-artifact@v4
with:
name: linux-deb-build
- name: Download the windows64 build output
uses: actions/download-artifact@v4
with:
name: windows64-installer-signed
- name: Download the apk build output
uses: actions/download-artifact@v4
with:
name: android-apk-build
- name: Download the aab build output
uses: actions/download-artifact@v4
with:
name: android-aab-build
# - name: Download the IPA
# uses: actions/download-artifact@v4
# with:
# name: Lantern.ipa
# - name: Upload Lantern to TestFlight
# uses: apple-actions/upload-testflight-build@v1
# if: (needs.set-version.outputs.prefix == 'lantern-installer-preview'|| needs.set-version.outputs.prefix == 'lantern-installer') && (needs.determine-platform.outputs.platform == 'ios' || needs.determine-platform.outputs.platform == 'all')
# with:
# app-path: Lantern.ipa
# issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
# api-key-id: ${{ secrets.APPSTORE_API_KEY_ID }}
# api-private-key: ${{ secrets.APPSTORE_API_PRIVATE_KEY }}
- name: Upload Android App bundle to Play Store (beta)
if: needs.set-version.outputs.prefix == 'lantern-installer-preview' && (needs.determine-platform.outputs.platform == 'android' || needs.determine-platform.outputs.platform == 'all')
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: org.getlantern.lantern
releaseFiles: lantern-installer.aab
track: beta
debugSymbols: ${{ github.workspace }}/build/outputs/debug-symbols/debug-symbols.zip
mappingFile: ${{ github.workspace }}/build/app/outputs/mapping/prodPlay/mapping.txt
- name: Upload Android App bundle to Play Store (production)
if: needs.set-version.outputs.prefix == 'lantern-installer' && (needs.determine-platform.outputs.platform == 'android' || needs.determine-platform.outputs.platform == 'all')
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: org.getlantern.lantern
releaseFiles: lantern-installer.aab
track: production
debugSymbols: ${{ github.workspace }}/build/outputs/debug-symbols/debug-symbols.zip
mappingFile: ${{ github.workspace }}/build/app/outputs/mapping/prodPlay/mapping.txt
- name: Grant private modules access
run: git config --global url."https://${{ secrets.CI_PRIVATE_REPOS_GH_TOKEN }}:[email protected]/".insteadOf "https://github.com/"
- name: Clone binaries repo
run: git clone --depth 1 https://github.com/getlantern/lantern-binaries
- name: Rename builds
run: |
diff lantern-installer.apk ${{ env.prefix }}.apk || mv -f lantern-installer.apk ${{ env.prefix }}.apk
diff lantern-installer.aab ${{ env.prefix }}.aab || mv -f lantern-installer.aab ${{ env.prefix }}.aab
mv -f lantern-installer-x64.deb ${{ env.prefix }}-64-bit.deb
mv -f lantern-installer-x64.rpm ${{ env.prefix }}.rpm
mv -f lantern-installer.dmg ${{ env.prefix }}.dmg
diff lantern-installer-x64.exe ${{ env.prefix }}-64-bit.exe || mv -f lantern-installer-x64.exe ${{ env.prefix }}-64-bit.exe
mv -f Lantern.ipa ${{ env.prefix }}.ipa
- name: Prepare sha256 sums
run: |
shasum -a 256 ${{ env.prefix }}.apk | cut -d " " -f 1 > ${{ env.prefix }}.apk.sha256
shasum -a 256 ${{ env.prefix }}.aab | cut -d " " -f 1 > ${{ env.prefix }}.aab.sha256
shasum -a 256 ${{ env.prefix }}-mac.dmg | cut -d " " -f 1 > ${{ env.prefix }}-mac.dmg.sha256
shasum -a 256 ${{ env.prefix }}-mac_arm.dmg | cut -d " " -f 1 > ${{ env.prefix }}-mac_arm.dmg.sha256
shasum -a 256 ${{ env.prefix }}-x64.exe | cut -d " " -f 1 > ${{ env.prefix }}-x64.exe.sha256
shasum -a 256 ${{ env.prefix }}-64-bit.deb | cut -d " " -f 1 > ${{ env.prefix }}-64-bit.deb.sha256
shasum -a 256 ${{ env.prefix }}.ipa | cut -d " " -f 1 > ${{ env.prefix }}.ipa.sha256
- name: Commit
run: |
mv lantern-installer* ./lantern-binaries/
cd lantern-binaries
git config user.email "[email protected]"
git config user.name "Lantern Bot"
git add .
git commit -m "Lantern binaries for version ${{ env.version }}"
git push origin main