aves/.github/workflows/release.yml
2022-02-22 18:25:14 +09:00

103 lines
3.7 KiB
YAML

name: Release on tag
on:
push:
tags:
- v*
jobs:
build:
name: Build and release artifacts.
runs-on: ubuntu-latest
steps:
- uses: actions/setup-java@v1
with:
java-version: '11.x'
- uses: subosito/flutter-action@v1
with:
channel: stable
flutter-version: '2.10.2'
# Workaround for this Android Gradle Plugin issue (supposedly fixed in AGP 4.1):
# https://issuetracker.google.com/issues/144111441
- name: Install NDK
run: echo "y" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT}
- name: Clone the repository.
uses: actions/checkout@v2
- name: Get packages for the Flutter project.
run: flutter pub get
- name: Update the flutter version file.
working-directory: ${{ github.workspace }}/scripts
run: ./update_flutter_version.sh
- name: Static analysis.
run: flutter analyze
- name: Unit tests.
run: flutter test
- name: Build signed artifacts.
# `KEY_JKS` should contain the result of:
# gpg -c --armor keystore.jks
# `KEY_JKS_PASSPHRASE` should contain the passphrase used for the command above
# The SkSL bundle must be produced with the same Flutter engine as the one used to build the artifact
# flutter build <subcommand> --bundle-sksl-path shaders.sksl.json
run: |
echo "${{ secrets.KEY_JKS }}" > release.keystore.asc
gpg -d --passphrase "${{ secrets.KEY_JKS_PASSPHRASE }}" --batch release.keystore.asc > $AVES_STORE_FILE
rm release.keystore.asc
mkdir outputs
(cd scripts/; ./apply_flavor_play.sh)
flutter build appbundle -t lib/main_play.dart --flavor play --bundle-sksl-path shaders_2.10.2.sksl.json
cp build/app/outputs/bundle/playRelease/*.aab outputs
flutter build apk -t lib/main_play.dart --flavor play --bundle-sksl-path shaders_2.10.2.sksl.json
cp build/app/outputs/apk/play/release/*.apk outputs
(cd scripts/; ./apply_flavor_izzy.sh)
flutter build apk -t lib/main_izzy.dart --flavor izzy --split-per-abi --bundle-sksl-path shaders_2.10.2.sksl.json
cp build/app/outputs/apk/izzy/release/*.apk outputs
rm $AVES_STORE_FILE
env:
AVES_STORE_FILE: ${{ github.workspace }}/key.jks
AVES_STORE_PASSWORD: ${{ secrets.AVES_STORE_PASSWORD }}
AVES_KEY_ALIAS: ${{ secrets.AVES_KEY_ALIAS }}
AVES_KEY_PASSWORD: ${{ secrets.AVES_KEY_PASSWORD }}
AVES_GOOGLE_API_KEY: ${{ secrets.AVES_GOOGLE_API_KEY }}
- name: Create a release with the APK and App Bundle.
uses: ncipollo/release-action@v1
with:
artifacts: "outputs/*"
body: "[Changelog](https://github.com/${{ github.repository }}/blob/develop/CHANGELOG.md#${{ github.ref_name }})"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload app bundle
uses: actions/upload-artifact@v2
with:
name: appbundle
path: outputs/app-play-release.aab
release:
name: Create beta release on Play Store.
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get appbundle from artifacts.
uses: actions/download-artifact@v2
with:
name: appbundle
- name: Release app to beta channel.
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.PLAYSTORE_ACCOUNT_KEY }}
packageName: deckers.thibault.aves
releaseFiles: app-play-release.aab
track: beta
status: completed
whatsNewDirectory: whatsnew