Skip to content

Commit

Permalink
Merge branch 'LibreScore:master' into Sdreatgitub-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
SdreatGithub authored Dec 18, 2024
2 parents 5a3aa36 + 4d09f51 commit 55a8a8a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 37 deletions.
68 changes: 38 additions & 30 deletions .github/workflows/build_app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,29 @@ on:
push:
tags:
- "v*.*.*"

env:
librescore_b_name: ${{ secrets.LIBRESCORE_B_NAME }}

jobs:
release:
runs-on: ubuntu-latest
outputs:
updated: ${{ steps.get_latest_release.outputs.updated }}
steps:
- name: Get latest release
id: get_latest_release
run: |
echo "updated=true" >> $GITHUB_ENV
echo "updated=true" >> "$GITHUB_OUTPUT"
if [[ "${{ github.ref_name }}" == "$(curl -s -u ${{ secrets.LIBRESCORE_USERNAME }}:${{ secrets.LIBRESCORE_TOKEN }} -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}/releases/latest | jq --raw-output ".tag_name")" ]]; then
echo "updated=false" >> $GITHUB_ENV
exit 1
echo "updated=false" >> "$GITHUB_OUTPUT"
fi
- name: Fail
if: steps.get_latest_release.outputs.updated == 'false'
run: |
exit 1
- name: Publish pre-release
if: env.updated == 'true'
if: steps.get_latest_release.outputs.updated == 'true'
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.LIBRESCORE_TOKEN }}
Expand All @@ -41,34 +48,41 @@ jobs:
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 }}
runs-on: ${{ startsWith(matrix.os, 'ubuntu-latest') && 'ubuntu-latest' || matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest-1, ubuntu-latest-2, ubuntu-latest-3, windows-latest, macos-latest]
fail-fast: true
steps:
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.10.x"
flutter-version: "3.19.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
if: matrix.os != 'ubuntu-latest-3'
with:
repository: LibreScore/${{ secrets.LIBRESCORE_REPO_A }}
token: ${{ secrets.LIBRESCORE_TOKEN }}
submodules: 'recursive'
- uses: actions/checkout@v3
if: matrix.os == 'ubuntu-latest-3'
with:
repository: LibreScore/${{ secrets.LIBRESCORE_REPO_B }}
token: ${{ secrets.LIBRESCORE_TOKEN }}
submodules: 'recursive'
- name: Import GPG key
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest-1'
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'
if: matrix.os == 'ubuntu-latest-1'
run: |
sudo apt update -y
sudo apt install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev fuse libfuse2
Expand All @@ -85,21 +99,21 @@ Installation instructions are in the [README](https://github.com/LibreScore/${{
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'
if: matrix.os == 'ubuntu-latest-1'
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'
if: matrix.os == 'ubuntu-latest-2' || matrix.os == 'ubuntu-latest-3'
with:
distribution: "zulu"
java-version: "17"
cache: "gradle"
- name: Build APK
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest-2'
run: |
echo "${{ secrets.UPLOAD_KEYSTORE_JKS_A }}" | base64 --decode > ./android/upload-keystore.jks
echo "storePassword=${{ secrets.KEYSTORE_STORE_PASSWORD_A }}" > ./android/key.properties
Expand All @@ -114,7 +128,7 @@ Installation instructions are in the [README](https://github.com/LibreScore/${{
mv ./build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk ./LibreScore-armeabi-v7a.apk
mv ./build/app/outputs/flutter-apk/app-x86_64-release.apk ./LibreScore-x86_64.apk
- name: Upload APK
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest-2'
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.LIBRESCORE_TOKEN }}
Expand All @@ -124,14 +138,8 @@ Installation instructions are in the [README](https://github.com/LibreScore/${{
./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'
if: matrix.os == 'ubuntu-latest-3'
run: |
echo "${{ secrets.UPLOAD_KEYSTORE_JKS_B }}" | base64 --decode > ./android/upload-keystore.jks
echo "storePassword=${{ secrets.KEYSTORE_STORE_PASSWORD_B }}" > ./android/key.properties
Expand All @@ -147,7 +155,7 @@ Installation instructions are in the [README](https://github.com/LibreScore/${{
mv ./build/app/outputs/flutter-apk/app-x86_64-release.apk ./${{ secrets.LIBRESCORE_B_NAME }}-x86_64.apk
./meta.sh &>/dev/null
- name: Upload APK
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest-3'
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.LIBRESCORE_TOKEN }}
Expand Down Expand Up @@ -179,22 +187,22 @@ Installation instructions are in the [README](https://github.com/LibreScore/${{
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
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
& "${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\x64\runner\Release\librescore.exe
Get-ChildItem -Path .\build\windows\x64\runner\Release -File | Where {($_.Extension -ne ".dll" -and $_.Extension -ne ".exe")} | Remove-Item
Copy-Item (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find 'VC\Redist\MSVC\*\x64\*\msvcp140.dll') .\build\windows\x64\runner\Release
Copy-Item (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140.dll') .\build\windows\x64\runner\Release
Copy-Item (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140_1.dll') .\build\windows\x64\runner\Release
dart 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 -Path .\build\windows\runner\Release -Destination .\installer\Inno\LibreScore -Recurse
Copy-Item -Path .\build\windows\x64\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
Compress-Archive -Path .\build\windows\x64\runner\Release\* -DestinationPath .\installer\LibreScore.zip
- name: Upload EXE
if: matrix.os == 'windows-latest'
uses: softprops/action-gh-release@v1
Expand Down Expand Up @@ -235,7 +243,7 @@ Installation instructions are in the [README](https://github.com/LibreScore/${{
runs-on: ubuntu-latest
steps:
- name: Delete pre-release
if: env.updated == 'true'
if: needs.release.outputs.updated == 'true'
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
Expand All @@ -244,6 +252,6 @@ Installation instructions are in the [README](https://github.com/LibreScore/${{
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 }}
- name: Delete workflow run
if: env.updated == 'false'
if: needs.release.outputs.updated == 'false'
run: |
curl -s -i -u ${{ secrets.LIBRESCORE_USERNAME }}:${{ secrets.LIBRESCORE_TOKEN }} -d '{"event_type":"delete_action","client_payload":{"run_id":"'"${{ github.run_id }}"'","repo":"LibreScore/app-librescore"}}' -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/LibreScore/actions/dispatches
10 changes: 6 additions & 4 deletions .github/workflows/publish_new_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ jobs:
id: get-latest-release
run: |
echo "updated=false" >> $GITHUB_ENV
echo "CURRENT_VERSION=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/LibreScore/app-librescore/releases/latest | jq --raw-output ".tag_name")" >> "$GITHUB_OUTPUT"
echo "LATEST_VERSION=$(curl -s -u ${{ secrets.LIBRESCORE_USERNAME }}:${{ secrets.LIBRESCORE_TOKEN }} -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}/releases/latest | jq --raw-output ".tag_name")" >> "$GITHUB_OUTPUT"
if [[ ${{ steps.get-latest-release.outputs.CURRENT_VERSION }} != ${{ steps.get-latest-release.outputs.LATEST_VERSION }} ]]; then
CURRENT_VERSION="$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/LibreScore/app-librescore/releases/latest | jq --raw-output ".tag_name")"
LATEST_VERSION="$(curl -s -u ${{ secrets.LIBRESCORE_USERNAME }}:${{ secrets.LIBRESCORE_TOKEN }} -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}/releases/latest | jq --raw-output ".tag_name")"
echo "CURRENT_VERSION=$CURRENT_VERSION" >> "$GITHUB_ENV"
echo "LATEST_VERSION=$LATEST_VERSION" >> "$GITHUB_ENV"
if [[ $CURRENT_VERSION != $LATEST_VERSION ]]; then
echo "updated=true" >> $GITHUB_ENV
fi
for i in {0..10}; do
Expand Down Expand Up @@ -48,7 +50,7 @@ jobs:
echo "${{ secrets.SSH_KEY }}" | base64 --decode > $HOME/id_rsa
chmod 600 $HOME/id_rsa
ssh -i $HOME/id_rsa -o StrictHostKeyChecking=accept-new ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_DOMAIN }} -p ${{ secrets.SSH_PORT }} 'sudo -u postgres psql librescore -c "create or replace function auth.check_token() returns void language plpgsql as \$\$ begin if current_setting('"'request.jwt.claims', true)::json->>'version' not in ('server', '${{ steps.get-latest-release.outputs.CURRENT_VERSION }}', '${{ steps.get-latest-release.outputs.LATEST_VERSION }}') then raise insufficient_privilege using hint = 'Outdated version'"'; end if; end \$\$;"'
ssh -i $HOME/id_rsa -o StrictHostKeyChecking=accept-new ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_DOMAIN }} -p ${{ secrets.SSH_PORT }} 'sudo -u postgres psql librescore -c "create or replace function auth.check_token() returns void language plpgsql as \$\$ begin if current_setting('"'request.jwt.claims', true)::json->>'version' not in ('server', '${{ env.CURRENT_VERSION }}', '${{ env.LATEST_VERSION }}') then raise insufficient_privilege using hint = 'Outdated version'"'; end if; end \$\$;"'
- name: Upload assets
if: env.updated == 'true'
uses: softprops/action-gh-release@v1
Expand Down
6 changes: 3 additions & 3 deletions l10n/app_cs.arb
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@
"description": "Button text to get Discord support",
"type": "text"
},
"proxyUrlHint": "",
"proxyUrlHint": "Zadejte URL proxy serveru",
"@proxyUrlHint": {},
"proxyText": "",
"proxyText": "Použít server proxy",
"@proxyText": {},
"dynamicColorText": "",
"dynamicColorText": "Dynamická barva",
"@dynamicColorText": {
"description": "Dynamic color settings label",
"type": "text"
Expand Down

0 comments on commit 55a8a8a

Please sign in to comment.