Bug fixes #47
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 Flutter APK and AppBundle | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
flutter-version: ['stable'] | |
permissions: write-all | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set Up Java | |
uses: actions/[email protected] | |
with: | |
distribution: 'oracle' | |
java-version: '17' | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.24.3' | |
channel: 'stable' | |
- name: Install dependencies | |
run: | | |
flutter pub get | |
flutter pub run flutter_launcher_icons | |
- name: Decode Keystore | |
run: | | |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > android/app/keystore.jks | |
- name: Create key.properties | |
run: | | |
echo "storePassword=${{ secrets.KEYSTORE_PASSWORD }}" > android/key.properties | |
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties | |
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties | |
echo "storeFile=keystore.jks" >> android/key.properties | |
- name: Create debug info directory | |
run: | | |
mkdir -p ./build/symbols/apk | |
mkdir -p ./build/symbols/appbundle | |
- name: Build APK | |
run: flutter build apk --release --obfuscate --split-debug-info=./build/symbols/apk | |
- name: Build AppBundle | |
run: flutter build appbundle --release --obfuscate --split-debug-info=./build/symbols/appbundle | |
- name: Run Test | |
run: flutter test | |
- name: Upload APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: apk-release | |
path: build/app/outputs/flutter-apk/app-release.apk | |
- name: Upload AppBundle | |
uses: actions/upload-artifact@v4 | |
with: | |
name: appbundle-release | |
path: build/app/outputs/bundle/release/app-release.aab | |
- name: Upload Symbols APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: apk-symbols | |
path: ./build/symbols/apk | |
- name: Upload Symbols AppBundle | |
uses: actions/upload-artifact@v4 | |
with: | |
name: appbundle-symbols | |
path: ./build/symbols/appbundle | |
- name: Upload Native Symbols | |
uses: actions/upload-artifact@v4 | |
with: | |
name: native-symbols | |
path: ./build/app/intermediates/merged_native_libs/release/out/lib | |
- name: Extract version from pubspec.yaml | |
id: extract_version | |
run: | | |
version=$(grep '^version:' pubspec.yaml | sed 's/version: //') | |
echo "VERSION=${version}" >> $GITHUB_ENV | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} | |
with: | |
tag_name: v${{ env.VERSION }} | |
name: Release v${{ env.VERSION }} | |
body: | | |
**New Flutter Release** | |
- Version: v${{ env.VERSION }} | |
- name: Upload APK to Release | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: build/app/outputs/flutter-apk/app-release.apk | |
asset_name: app-release.apk | |
asset_content_type: application/vnd.android.package-archive | |
- name: Upload AppBundle to Release | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: build/app/outputs/bundle/release/app-release.aab | |
asset_name: app-release.aab | |
asset_content_type: application/octet-stream | |
- name: Upload APK Symbols to Release | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./build/symbols/apk | |
asset_name: apk-symbols.zip | |
asset_content_type: application/zip | |
- name: Upload AppBundle Symbols to Release | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./build/symbols/appbundle | |
asset_name: appbundle-symbols.zip | |
asset_content_type: application/zip |