Flutter Build and Upload APK test #21
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: Flutter Build and Upload APK test | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Decode Keystore | |
run: | | |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > android/app/keystore.jks | |
- name: Build AAB | |
env: | |
KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }} | |
run: | | |
flutter build appbundle --release \ | |
--build-number=${{ github.run_number }} \ | |
--build-name=0.2.${{ github.run_number }} | |
# - name: Upload AAB | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: release-aab | |
# path: build/app/outputs/bundle/release/app-release.aab | |
- name: Build APK | |
env: | |
KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }} | |
run: | | |
flutter build apk --release --split-per-abi \ | |
--build-number=${{ github.run_number }} \ | |
--build-name=0.2.${{ github.run_number }} | |
- name: List build outputs | |
run: | | |
ls -R build/app/outputs/ | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "build/app/outputs/flutter-apk/*.apk,build/app/outputs/bundle/release/app-release.aab" | |
tag: v0.2.${{ github.run_number }} | |
name: Release v0.2.${{ github.run_number }} | |
body: New release for version 1.0.${{ github.run_number }} | |
token: ${{ secrets.GITHUB_TOKEN }} |