v0.25.2 #136
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 REQUEST_INSTALL_PACKAGES permission | |
run: ./patches/remove_request_install_packages_permission.sh | |
- name: Setup keystore | |
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: 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' | |
- name: Disable Flutter CLI animations | |
run: flutter config --no-cli-animations | |
- 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: 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@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 |