Skip to content

Re-add distribution to setup java #17

Re-add distribution to setup java

Re-add distribution to setup java #17

Workflow file for this run

name: Build release artefacts
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
deploy_android:
runs-on: ubuntu-latest
steps:
- name: Checkout application code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'oracle'
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.16.x
- name: Flutter info
run: |
dart --version
flutter --version
- name: Install Flutter dependencies
run: flutter pub get
- name: Decrypt config files
run: |
cd ./fastlane/metadata/envfiles
chmod +x ./decrypt_secrets.sh
./decrypt_secrets.sh
env:
DECRYPTKEY_PLAYSTORE: ${{ secrets.DECRYPTKEY_PLAYSTORE }}
DECRYPTKEY_PLAYSTORE_SIGNING_KEY: ${{ secrets.DECRYPTKEY_PLAYSTORE_SIGNING_KEY }}
DECRYPTKEY_PROPERTIES: ${{ secrets.DECRYPTKEY_PROPERTIES }}
- 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
- name: Bump pubspec version
run: |
flutter pub run cider version ${{ env.VERSION }}+${{ env.BUILD }}
flutter pub run cider bump build
- name: Build application for linux
run: |
sudo apt update
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 --addTodaysVersion ${{ env.VERSION }}
- name: Build AAB
run: flutter build appbundle --release
env:
WGER_API_KEY: ${{ secrets.WGER_API_KEY }}
- name: Upload build to Play Store
uses: maierj/[email protected]
with:
lane: production
- name: Make Github release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
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
mkdir ../../flathub
cp flatpak_generator_exports/de.wger.flutter.json ../../flathub
- name: Push updated 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: de.wger.flutter
user-email: [email protected]
target-branch: release-${{ env.VERSION }}
create-target-branch-if-needed: true
commit-message: Update to ${{ env.VERSION }}
# 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 tag
run: |
git config user.name Github-Actions
git config user.email [email protected]
git checkout -b release-${{ env.VERSION }}
git add pubspec.yaml
git commit -m "Bump version to $( flutter pub run cider version )"
git tag ${{ env.VERSION }}
git push ${{ env.VERSION }}
git push --delete ${{ env.VERSION_V }}
git push