Skip to content

v1.27.1

v1.27.1 #195

name: Build for Play Store
on:
# Enable manual run
workflow_dispatch:
push:
tags:
- "**"
branches:
- "**"
paths:
- .github/workflows/android-play-store.yml
jobs:
build-aab:
name: Build AAB for the Play Store
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v5
- uses: "./.github/shared_workflows/install_apt_dependencies"
- name: Setup cache
uses: actions/cache/restore@v4
with:
path: |
.dart_tool/
build/
linux/flutter/ephemeral/
macos/Flutter/ephemeral/
windows/flutter/ephemeral/
.flutter-plugins-dependencies
pubspec.lock
key: ${{ runner.OS }}-saber-${{ hashFiles('**/pubspec.lock') }}-${{ hashFiles('**/*.dart') }}
restore-keys: |
${{ runner.OS }}-saber-
- name: Setup keystore
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
if: ${{ env.SIGNING_KEY != '' }}
run: |
echo "${{ secrets.SIGNING_KEY }}" | base64 -d > android/android.keystore
echo "storePassword=${{ secrets.KEY_STORE_PASSWORD }}" > android/key.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.ALIAS }}" >> android/key.properties
echo "storeFile=../android.keystore" >> android/key.properties
- name: Setup Flutter
uses: adil192/setup-flutter-submodule@v1
with:
flutter-path: submodules/flutter
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: "microsoft"
java-version: "21"
- name: Setup Rust
uses: moonrepo/setup-rust@v1
with:
# The rust version is read from rust-toolchain.toml
targets: armv7-linux-androideabi,aarch64-linux-android,x86_64-linux-android
- name: Disable Flutter CLI animations
run: flutter config --no-cli-animations
- run: flutter pub get
- name: Remove REQUEST_INSTALL_PACKAGES permission
run: ./patches/remove_request_install_packages_permission.sh
- name: Remove development dependencies
run: ./patches/remove_dev_dependencies.sh
- name: Remove non-Android dependencies
run: ./patches/remove_non_android_dependencies.sh
- name: Patch rust dependencies
run: ./patches/patch_rust_versions.sh
- name: Build aab
run: |
flutter build appbundle \
--dart-define=FLAVOR="Google Play" \
--dart-define=APP_STORE="Google Play" \
--dart-define=UPDATE_CHECK="false" \
--dart-define=DIRTY="false"
- name: Rename aab
run: |
mkdir -p output
mv build/app/outputs/bundle/release/app-release.aab output/Saber.aab
- name: Upload artifact
uses: actions/upload-artifact@v5
with:
name: Saber-Android-PlayStore
path: output/Saber.aab
upload-to-play-store:
name: Upload to Play Store
runs-on: ubuntu-latest
needs: build-aab
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Download artifact
uses: actions/download-artifact@v6
with:
name: Saber-Android-PlayStore
path: output
- name: Prepare whatsnew directory from metadata/*/changelogs
working-directory: ${{ github.workspace }}
run: |
# display changelogs for debugging
find metadata -name '*.txt'
mkdir -p whatsnew
# get current version code from lib/data/version.dart
VERSION_CODE=$(grep -oP '(?<=buildNumber = )\d+' lib/data/version.dart)
# copy changelogs of each language to whatsnew
for dir in metadata/*/changelogs; do
# get language code from directory name
# e.g. metadata/en-US/changelogs -> en-US
lang=${dir#metadata/}
lang=${lang%/changelogs}
# get original changelog file
original="$dir/$VERSION_CODE.txt"
if [ -f "$original" ]; then
# copy changelog file to whatsnew
cp "$original" "whatsnew/whatsnew-${lang}"
fi
done
- name: Upload to Play Store
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.PLAY_STORE_JSON }}
packageName: com.adilhanney.saber
releaseFiles: output/Saber.aab
track: production
status: completed
whatsNewDirectory: whatsnew