Files
flutter/.github/workflows/android-release.yml

133 lines
4.4 KiB
YAML

name: Google Play release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
defaults:
run:
working-directory: wger
jobs:
deploy_android:
runs-on: ubuntu-latest
steps:
- 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
with:
java-version: 17.x
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3
- name: Setup Flutter
uses: subosito/flutter-action@v1
with:
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: |
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 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
env:
WGER_API_KEY: ${{ secrets.WGER_API_KEY }}
- name: Upload build to Play Store
uses: maierj/fastlane-action@v2.2.1
with:
lane: production
- name: Make Github release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
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 }}