v0.24.2 #123
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v4 | |
- name: Setup cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
build | |
key: ${{ runner.OS }}-saber-${{ hashFiles('**/pubspec.lock') }}-${{ hashFiles('**/*.dart') }} | |
restore-keys: | | |
${{ runner.OS }}-saber- | |
- name: Remove signingConfig | |
run: ./patches/remove_signing_android.sh | |
- name: Remove REQUEST_INSTALL_PACKAGES permission | |
run: ./patches/remove_request_install_packages_permission.sh | |
- name: Remove simulator dependency | |
run: ./patches/remove_simulator_dependency.sh | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
cache: true | |
cache-key: 'flutter-:os:-:channel:-:version:-:arch:' | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'microsoft' | |
java-version: '17' | |
- run: flutter pub get | |
- 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: Move unsigned apk | |
run: | | |
mkdir -p output | |
mv build/app/outputs/bundle/release/app-release.aab output/Saber.aab | |
- name: Sign aab | |
uses: ilharp/sign-android-release@v1 | |
id: sign_app | |
with: | |
releaseDir: output | |
signingKey: ${{ secrets.SIGNING_KEY }} | |
keyAlias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
- name: Rename signed apk | |
run: mv ${{ steps.sign_app.outputs.signedFile }} output/Saber.aab | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
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@v4 | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
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 |