From 823b3aa88511d240ba336e649061fc1bea4c6ae3 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Mon, 17 Apr 2023 21:05:47 +0200 Subject: [PATCH] Update release workflow file to also build flathub packages --- .github/workflows/android-release.yml | 102 ++++++++++++++++++-------- .github/workflows/flathub-release.yml | 7 +- 2 files changed, 77 insertions(+), 32 deletions(-) diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index e21c683c..49550ecd 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -4,12 +4,24 @@ on: tags: - 'v[0-9]+.[0-9]+.[0-9]+' + defaults: + run: + working-directory: wger + jobs: deploy_android: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Checkout application code uses: actions/checkout@v2 + with: + path: wger + + - name: Checkout flathub repo + uses: actions/checkout@v3 + with: + repository: wger-project/test + path: flathub - name: Setup Java uses: actions/setup-java@v1 @@ -19,13 +31,21 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '3' + ruby-version: 3 - name: Setup Flutter uses: subosito/flutter-action@v1 with: - channel: 'stable' - flutter-version: '3.7.x' + channel: stable + flutter-version: 3.7.x + + - name: Flutter info + run: | + dart --version + flutter --version + + - name: Install Flutter dependencies + run: flutter pub get - name: Decrypt config files run: | @@ -37,39 +57,24 @@ jobs: DECRYPTKEY_PLAYSTORE_SIGNING_KEY: ${{ secrets.DECRYPTKEY_PLAYSTORE_SIGNING_KEY }} DECRYPTKEY_PROPERTIES: ${{ secrets.DECRYPTKEY_PROPERTIES }} - - name: Flutter info - run: | - dart --version - flutter --version - - - name: Install Flutter dependencies - run: flutter pub get - - name: Extract version information run: | echo "VERSION_V=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_ENV echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3 | cut -c 2-)" >> $GITHUB_ENV echo "BUILD=$(flutter pub run cider version | cut -d '+' -f 2)" >> $GITHUB_ENV - # Note: the original tag that triggered the workflow is in the form vX.Y.Z - # but the pubspec.yaml is committed in the commit after that one. - # Since we need the tag to point to the correct commit for other workflows - # such as f-droid we need a way to correct it. Only moving the tag - # would not work, as it would trigger this workflow again. So as - # a workaround, we use the v-tag to trigger this workflow, add a new - # one without the v and push it. - - name: Bump version + - name: Bump pubspec version run: | flutter pub run cider version ${{ env.VERSION }}+${{ env.BUILD }} flutter pub run cider bump build - git config user.name Github-actions - git config user.email github-actions@github.com - git add . - git commit -m "Bump version to $( flutter pub run cider version )" - git tag ${{ env.VERSION }} - git push origin HEAD:master --tags - git push origin --delete ${{ env.VERSION_V }} + - name: Build application for linux + run: | + sudo apt install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev + flutter build linux --release + cd flatpak/scripts + dart pub get + dart flatpak_packager.dart --meta ../flatpak_meta.json --github - name: Build AAB run: flutter build appbundle --release @@ -84,6 +89,45 @@ jobs: - name: Make Github release uses: softprops/action-gh-release@v1 with: - files: build/app/outputs/bundle/release/app-release.aab tag_name: ${{ env.VERSION }} - body_path: CHANGELOG.md \ No newline at end of file + body_path: CHANGELOG.md + files: | + build/app/outputs/bundle/release/app-release.aab + flatpak/scripts/flatpak_generator_exports/wger-linux-x86_64.tar.gz + flatpak/scripts/flatpak_generator_exports/wger-linux-x86_64.sha256 + + - name: Generate flathub manifest + run: | + cd flatpak/scripts + dart pub get + dart manifest_generator.dart --meta ../flatpak_meta.json --github + cp flatpak_generator_exports/de.wger.flutter.json ../../../flathub + + - name: Push config to flathub repository + uses: cpina/github-action-push-to-another-repository@main + env: + SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} + with: + source-directory: flathub + destination-github-username: wger-project + destination-repository-name: test + user-email: github-actions@github.com + target-branch: master + commit-message: Update de.wger.flutter.json + + # Note: the original tag that triggered the workflow is in the form vX.Y.Z + # but the pubspec.yaml is committed in the commit after that one. + # Since we need the tag to point to the correct commit for other workflows + # such as f-droid we need a way to correct it. Only moving the tag + # would not work, as it would trigger this workflow again. So as + # a workaround, we use the v-tag to trigger this workflow, add a new + # one without the v and push it. + - name: Commit pubspec version and delete branch + run: | + git config user.name Github-actions + git config user.email github-actions@github.com + git add . + git commit -m "Bump version to $( flutter pub run cider version )" + git tag ${{ env.VERSION }} + git push origin HEAD:master --tags + git push origin --delete ${{ env.VERSION_V }} \ No newline at end of file diff --git a/.github/workflows/flathub-release.yml b/.github/workflows/flathub-release.yml index 5e518559..e7d8153a 100644 --- a/.github/workflows/flathub-release.yml +++ b/.github/workflows/flathub-release.yml @@ -21,6 +21,7 @@ jobs: with: repository: wger-project/test path: flathub + - name: Setup Java uses: actions/setup-java@v1 with: @@ -56,8 +57,8 @@ jobs: flutter build linux --release cd flatpak/scripts dart pub get - dart flatpak_packager.dart --meta ../flatpak_meta.json --github -n pubspec.yaml - dart manifest_generator.dart --meta ../flatpak_meta.json --github -n pubspec.yaml + dart flatpak_packager.dart --meta ../flatpak_meta.json --github + dart manifest_generator.dart --meta ../flatpak_meta.json --github cp flatpak_generator_exports/de.wger.flutter.json ../../../flathub ls flatpak_generator_exports/wger-linux-x86_64.sha256 @@ -86,7 +87,7 @@ jobs: - name: Upload SHA256 checksum archive uses: actions/upload-artifact@v3 with: - name: Flatpak file + name: Flatpak checksum file path: wger/flatpak/scripts/flatpak_generator_exports/wger-linux-x86_64.sha256 #- name: Build AAB