-
Notifications
You must be signed in to change notification settings - Fork 18
233 lines (215 loc) · 15.4 KB
/
build_app.yaml
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
name: Build app
on:
push:
tags:
- "v*.*.*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Publish pre-release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.LIBRESCORE_TOKEN }}
repository: LibreScore/${{ secrets.LIBRESCORE_REPO_A }}
body: '## Download
| <img src="https://upload.wikimedia.org/wikipedia/commons/e/e2/Windows_logo_and_wordmark_-_2021.svg" width="512"> | <img src="https://upload.wikimedia.org/wikipedia/commons/2/21/MacOS_wordmark_%282017%29.svg" width="512"> | <img src="https://upload.wikimedia.org/wikipedia/commons/3/35/Tux.svg" width="512"> | <img src="https://upload.wikimedia.org/wikipedia/commons/3/31/Android_robot_head.svg" width="512"> |
| :---: | :---: | :---: | :---: |
| Windows (7+) (64-bit only) | macOS (10.11+) (Rosetta 2) | Linux (64-bit only) | Android (6.0+) |
| [Download (EXE)](https://github.com/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}/releases/download/${{ github.ref_name }}/LibreScore.exe) | [Download (DMG)](https://github.com/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}/releases/download/${{ github.ref_name }}/LibreScore.dmg) | [Download (AppImage)](https://github.com/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}/releases/download/${{ github.ref_name }}/LibreScore.AppImage) | [Download (APK)](https://github.com/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}/releases/download/${{ github.ref_name }}/LibreScore.apk) |
### Having trouble?
Installation instructions are in the [README](https://github.com/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}/blob/master/README.md) file.'
build:
needs: release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: true
steps:
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.10.x"
channel: "stable"
cache: true
cache-key: flutter
cache-path: ${{ runner.tool_cache }}/flutter
- run: git config --global url."https://".insteadOf git://
- uses: actions/checkout@v3
with:
repository: LibreScore/${{ secrets.LIBRESCORE_REPO_A }}
token: ${{ secrets.LIBRESCORE_TOKEN }}
submodules: 'recursive'
- name: Import GPG key
if: matrix.os == 'ubuntu-latest'
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.LIBRESCORE_GPG }}
passphrase: ${{ secrets.LIBRESCORE_GPG_PASSWORD }}
- name: Build AppImage
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt update -y
sudo apt install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev fuse libfuse2
flutter config --enable-linux-desktop
flutter clean
flutter build linux --obfuscate --split-debug-info=./build/app/outputs/symbols
patchelf --set-interpreter ./ld-linux-x86-64.so.2 ./build/linux/x64/release/bundle/librescore
ldd ./build/linux/x64/release/bundle/librescore | awk -F '=> ' 'NF>1{ sub(/ .*/,"",$NF); system("cp " $NF " ./build/linux/x64/release/bundle/lib/") }'
cp $(ldconfig -p | grep "librt\.." | awk -F '=> ' 'NF>1{ sub(/ .*/,"",$NF); print $NF }' | head -n 1) ./build/linux/x64/release/bundle/lib/
patchelf --add-needed librt.so.1 ./build/linux/x64/release/bundle/librescore
LD_LIBRARY_PATH=$LD_LIBRARY_PATH./build/linux/x64/release/bundle/lib ldd ./build/linux/x64/release/bundle/librescore | awk -F '=> ' 'NF>1{ sub(/ .*/,"",$NF); system("patchelf " $NF " --set-rpath \"\\$ORIGIN\"") }'
cp -R ./build/linux/x64/release/bundle/* ./installer/AppImage/
chmod a+x ./appimagetool.AppImage
ARCH=x86_64 ./appimagetool.AppImage ./installer/AppImage --no-appstream --sign
mv ./LibreScore-x86_64.AppImage ./LibreScore.AppImage
- name: Upload AppImage
if: matrix.os == 'ubuntu-latest'
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.LIBRESCORE_TOKEN }}
repository: LibreScore/${{ secrets.LIBRESCORE_REPO_A }}
files: |
./LibreScore.AppImage
- uses: actions/setup-java@v3
if: matrix.os == 'ubuntu-latest'
with:
distribution: "zulu"
java-version: "11"
cache: "gradle"
- name: Build APK
if: matrix.os == 'ubuntu-latest'
run: |
echo "${{ secrets.UPLOAD_KEYSTORE_JKS_A }}" | base64 --decode > ./android/upload-keystore.jks
echo "storePassword=${{ secrets.KEYSTORE_STORE_PASSWORD_A }}" > ./android/key.properties
echo "keyPassword=${{ secrets.KEYSTORE_KEY_PASSWORD_A }}" >> ./android/key.properties
echo "keyAlias=upload" >> ./android/key.properties
echo "storeFile=../upload-keystore.jks" >> ./android/key.properties
flutter clean
flutter build apk --obfuscate --split-debug-info=./build/app/outputs/symbols
mv ./build/app/outputs/apk/release/app-release.apk ./LibreScore.apk
flutter build apk --split-per-abi --obfuscate --split-debug-info=./build/app/outputs/symbols
mv ./build/app/outputs/apk/release/app-arm64-v8a-release.apk ./LibreScore-arm64-v8a.apk
mv ./build/app/outputs/apk/release/app-armeabi-v7a-release.apk ./LibreScore-armeabi-v7a.apk
mv ./build/app/outputs/apk/release/app-x86_64-release.apk ./LibreScore-x86_64.apk
- name: Upload APK
if: matrix.os == 'ubuntu-latest'
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.LIBRESCORE_TOKEN }}
repository: LibreScore/${{ secrets.LIBRESCORE_REPO_A }}
files: |
./LibreScore.apk
./LibreScore-arm64-v8a.apk
./LibreScore-armeabi-v7a.apk
./LibreScore-x86_64.apk
- uses: actions/checkout@v3
if: matrix.os == 'ubuntu-latest'
with:
repository: LibreScore/${{ secrets.LIBRESCORE_REPO_B }}
token: ${{ secrets.LIBRESCORE_TOKEN }}
submodules: 'recursive'
- name: Build APK
if: matrix.os == 'ubuntu-latest'
run: |
echo "${{ secrets.UPLOAD_KEYSTORE_JKS_B }}" | base64 --decode > ./android/upload-keystore.jks
echo "storePassword=${{ secrets.KEYSTORE_STORE_PASSWORD_B }}" > ./android/key.properties
echo "keyPassword=${{ secrets.KEYSTORE_KEY_PASSWORD_B }}" >> ./android/key.properties
echo "keyAlias=upload" >> ./android/key.properties
echo "storeFile=../upload-keystore.jks" >> ./android/key.properties
flutter clean
flutter build apk --obfuscate --split-debug-info=./build/app/outputs/symbols
mv ./build/app/outputs/apk/release/app-release.apk ./${{ secrets.LIBRESCORE_B_NAME }}.apk
flutter build apk --split-per-abi --obfuscate --split-debug-info=./build/app/outputs/symbols
mv ./build/app/outputs/apk/release/app-arm64-v8a-release.apk ./${{ secrets.LIBRESCORE_B_NAME }}-arm64-v8a.apk
mv ./build/app/outputs/apk/release/app-armeabi-v7a-release.apk ./${{ secrets.LIBRESCORE_B_NAME }}-armeabi-v7a.apk
mv ./build/app/outputs/apk/release/app-x86_64-release.apk ./${{ secrets.LIBRESCORE_B_NAME }}-x86_64.apk
- name: Upload APK
if: matrix.os == 'ubuntu-latest'
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.LIBRESCORE_TOKEN }}
repository: LibreScore/${{ secrets.LIBRESCORE_REPO_B }}
body: '## Download
| <img src="https://upload.wikimedia.org/wikipedia/commons/3/31/Android_robot_head.svg" width="256"> |
| :---: |
| Android (6.0+) |
| [Download (APK)](https://github.com/LibreScore/${{ secrets.LIBRESCORE_REPO_B }}/releases/download/${{ github.ref_name }}/${{ secrets.LIBRESCORE_B_NAME }}.apk) |
### Having trouble?
Installation instructions are in the [README](https://github.com/LibreScore/${{ secrets.LIBRESCORE_REPO_B }}/blob/master/README.md) file.'
files: |
./${{ secrets.LIBRESCORE_B_NAME }}.apk
./${{ secrets.LIBRESCORE_B_NAME }}-arm64-v8a.apk
./${{ secrets.LIBRESCORE_B_NAME }}-armeabi-v7a.apk
./${{ secrets.LIBRESCORE_B_NAME }}-x86_64.apk
- name: Build EXE
if: matrix.os == 'windows-latest'
run: |
flutter clean
flutter build windows --obfuscate --split-debug-info=.\build\app\outputs\symbols
"${{ secrets.LIBRESCORE_PFX }}" > .\installer\LibreScore.pfx.base64
certutil -decode .\installer\LibreScore.pfx.base64 .\installer\LibreScore.pfx
& "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x64\signtool.exe" sign /f .\installer\LibreScore.pfx /p ${{ secrets.LIBRESCORE_PFX_PASSWORD }} /tr http://timestamp.sectigo.com/ /fd SHA256 /td SHA256 .\build\windows\runner\Release\librescore.exe
Get-ChildItem -Path .\build\windows\runner\Release -File | Where {($_.Extension -ne ".dll" -and $_.Extension -ne ".exe")} | Remove-Item
flutter pub run msix:create
& "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x64\signtool.exe" sign /f .\installer\LibreScore.pfx /p ${{ secrets.LIBRESCORE_PFX_PASSWORD }} /tr http://timestamp.sectigo.com/ /fd SHA256 /td SHA256 .\installer\LibreScore.msix
Start-Process iexpress -ArgumentList /N,.\installer\MSIX\LibreScoreMsix.sed -NoNewWindow -Wait
& "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x64\signtool.exe" sign /f .\installer\LibreScore.pfx /p ${{ secrets.LIBRESCORE_PFX_PASSWORD }} /tr http://timestamp.sectigo.com/ /fd SHA256 /td SHA256 .\installer\LibreScoreMsix.exe
Copy-Item (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find 'VC\Redist\MSVC\*\x64\*\msvcp140.dll') .\build\windows\runner\Release
Copy-Item (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140.dll') .\build\windows\runner\Release
Copy-Item (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140_1.dll') .\build\windows\runner\Release
Copy-Item -Path .\build\windows\runner\Release -Destination .\installer\Inno\LibreScore -Recurse
New-Item -Name .\installer\Inno\LibreScore\data\flutter_assets\assets\.inno
iscc .\installer\Inno\LibreScore.iss
& "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x64\signtool.exe" sign /f .\installer\LibreScore.pfx /p ${{ secrets.LIBRESCORE_PFX_PASSWORD }} /tr http://timestamp.sectigo.com/ /fd SHA256 /td SHA256 .\installer\LibreScoreInno.exe
Start-Process iexpress -ArgumentList /N,.\installer\LibreScore.sed -NoNewWindow -Wait
& "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x64\signtool.exe" sign /f .\installer\LibreScore.pfx /p ${{ secrets.LIBRESCORE_PFX_PASSWORD }} /tr http://timestamp.sectigo.com/ /fd SHA256 /td SHA256 .\installer\LibreScore.exe
Compress-Archive -Path .\build\windows\runner\Release\* -DestinationPath .\installer\LibreScore.zip
- name: Upload EXE
if: matrix.os == 'windows-latest'
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.LIBRESCORE_TOKEN }}
repository: LibreScore/${{ secrets.LIBRESCORE_REPO_A }}
files: |
./installer/LibreScoreMsix.exe
./installer/LibreScoreInno.exe
./installer/LibreScore.exe
./installer/LibreScore.zip
- name: Build DMG
if: matrix.os == 'macos-latest'
run: |
flutter clean
flutter build macos --obfuscate --split-debug-info=build/app/outputs/symbols
hdiutil create -type SPARSEBUNDLE -size 97656.25k LibreScore
hdiutil attach ./LibreScore.sparsebundle
ln -s /Applications /Volumes/untitled
cp -R build/macos/Build/Products/Release/LibreScore.app /Volumes/untitled/
cp ./ds /Volumes/untitled/.DS_Store
hdiutil detach /Volumes/untitled
hdiutil convert -format UDRO -o LibreScore.dmg LibreScore.sparsebundle/
chmod 755 macos/Scripts/postinstall
pkgbuild --install-location /Applications --component ./build/macos/Build/Products/Release/LibreScore.app --scripts ./macos/Scripts ./LibreScore.pkg
- name: Upload DMG
if: matrix.os == 'macos-latest'
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.LIBRESCORE_TOKEN }}
repository: LibreScore/${{ secrets.LIBRESCORE_REPO_A }}
files: |
./LibreScore.dmg
./LibreScore.pkg
delete:
if: ${{ failure() }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Delete pre-release
run: |
ID_A="$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.LIBRESCORE_TOKEN }}" https://api.github.com/repos/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}/releases/tags/${{ github.ref_name }} | jq -r .id)"
curl -s -X DELETE -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.LIBRESCORE_TOKEN }}" https://api.github.com/repos/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}/releases/$ID_A
curl -s -X DELETE -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.LIBRESCORE_TOKEN }}" https://api.github.com/repos/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}/git/refs/tags/${{ github.ref_name }}
ID_B="$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.LIBRESCORE_TOKEN }}" https://api.github.com/repos/LibreScore/${{ secrets.LIBRESCORE_REPO_B }}/releases/tags/${{ github.ref_name }} | jq -r .id)"
curl -s -X DELETE -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.LIBRESCORE_TOKEN }}" https://api.github.com/repos/LibreScore/${{ secrets.LIBRESCORE_REPO_B }}/releases/$ID_B
curl -s -X DELETE -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.LIBRESCORE_TOKEN }}" https://api.github.com/repos/LibreScore/${{ secrets.LIBRESCORE_REPO_B }}/git/refs/tags/${{ github.ref_name }}