Release v0.7.1 #8
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: Android Release | |
on: | |
release: | |
types: [ published ] | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Release Tag' | |
required: true | |
upload: | |
description: 'Upload to Play Store?' | |
type: boolean | |
required: true | |
default: false | |
env: | |
GOOGLE_SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON }} | |
jobs: | |
android: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: "11.x" | |
cache: 'gradle' | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
cache: true | |
- name: Flutter version | |
run: flutter --version | |
- name: Install dependencies | |
run: flutter pub get | |
# <-------- START: Utility scripts --------> | |
- name: Get Tag | |
id: GetTag | |
run: echo "tag=$(dart scripts/get_tag.dart ${{ github.event.inputs.tag }} ${{ github.ref }})" >> $GITHUB_OUTPUT | |
- name: Get Pubspec Version | |
id: GetPubspecVersion | |
run: echo "version=$(dart scripts/pubspec_version.dart)" >> $GITHUB_OUTPUT | |
# <-------- END: Utility scripts --------> | |
- name: Create keystore file | |
uses: timheuer/base64-to-file@v1 | |
with: | |
fileName: 'release.jks' | |
fileDir: './android/keystore/' | |
encodedString: ${{ secrets.KEYSTORE_FILE }} | |
- name: Create keystore.properties file | |
run: echo "${{ secrets.KEYSTORE_PROPERTIES }}" > android/keystore.properties | |
- name: Build APK | |
run: flutter build apk --release --dart-define-from-file=configs/playstore.json | |
- name: Build AAB | |
run: flutter build appbundle --release --dart-define-from-file=configs/playstore.json | |
- name: Upload | |
if: ${{ inputs.upload || github.event_name == 'release' }} | |
run: | | |
gem install fastlane | |
bundle install | |
fastlane android upload | |
- name: Rename APK | |
run: mv build/app/outputs/flutter-apk/app-release.apk TargetMate-android-${{ steps.GetTag.outputs.tag }}.apk | |
- name: Rename AppBundle | |
run: mv build/app/outputs/bundle/release/app-release.aab TargetMate-android-${{ steps.GetTag.outputs.tag }}.aab | |
- name: Upload APK | |
uses: actions/upload-artifact@v3 | |
with: | |
path: TargetMate-android-${{ steps.GetTag.outputs.tag }}.apk | |
if-no-files-found: error | |
retention-days: 5 | |
- name: Upload AAB | |
uses: actions/upload-artifact@v3 | |
with: | |
path: TargetMate-android-${{ steps.GetTag.outputs.tag }}.aab | |
if-no-files-found: error | |
retention-days: 5 | |
- name: Clean up keystore and keystore.properties | |
if: ${{ always() }} | |
run: | | |
rm android/keystore.properties | |
rm android/keystore/release.jks |