Skip to content

Release v0.7.0

Release v0.7.0 #28

Workflow file for this run

name: Android Release
on:
release:
types: [ published ]
workflow_dispatch:
inputs:
tag:
description: 'Release Tag'
required: true
upload:
description: 'Upload to release?'
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/github.json
- name: Build AAB
run: flutter build appbundle --release --dart-define-from-file=configs/github.json
# - name: Upload
# if: ${{ inputs.upload_to_play_store || 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: Upload APK to release
if: ${{ inputs.upload || github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: TargetMate-android-${{ steps.GetTag.outputs.tag }}.apk
tag: refs/tags/${{ steps.GetTag.outputs.tag }}
overwrite: true
file_glob: true
- name: Upload AppBundle to release
if: ${{ inputs.upload || github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: TargetMate-android-${{ steps.GetTag.outputs.tag }}.aab
tag: refs/tags/${{ steps.GetTag.outputs.tag }}
overwrite: true
file_glob: true
- name: Clean up keystore and keystore.properties
if: ${{ always() }}
run: |
rm android/keystore.properties
rm android/keystore/release.jks