This repository has been archived by the owner on Sep 14, 2024. It is now read-only.
Publish #7
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: "Publish" | |
on: | |
workflow_dispatch: | |
jobs: | |
publish-android: | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⬇️ Checkout repository | |
uses: actions/checkout@v3 | |
- name: ⚙️ Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '12.x' | |
distribution: 'adopt' | |
cache: 'gradle' | |
- name: ⚙️ Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
cache: true | |
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' | |
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' | |
architecture: x64 | |
# This is seems to be only needed when running github actions locally with act | |
# - run: git config --global --add safe.directory /opt/hostedtoolcache/flutter/stable-3.13.0-x64 | |
- name: 📥 Downloading Dependencies | |
run: flutter pub get | |
# There are many issues currently that first need to be fixed to allow this rule | |
# - run: flutter analyze --fatal-infos ./ | |
- name: 📝 Format | |
run: dart format -o none --set-exit-if-changed ./ | |
- name: 🧪 Testing | |
run: flutter test | |
- name: 🛠️ Build APK | |
run: flutter build apk | |
- name: 🛠️ Build AppBundle | |
run: flutter build appbundle | |
- name: 🔐 Sign app APK | |
uses: r0adkll/sign-android-release@v1 | |
id: sign_app_apk | |
with: | |
releaseDirectory: ${{ github.workspace }}/build/app/outputs/apk/release | |
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }} | |
alias: ${{ secrets.ANDROID_KEY_ALIAS }} | |
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
- name: 🔐 Sign app AAB | |
uses: r0adkll/sign-android-release@v1 | |
id: sign_app_aab | |
with: | |
releaseDirectory: ${{ github.workspace }}/build/app/outputs/bundle/release | |
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }} | |
alias: ${{ secrets.ANDROID_KEY_ALIAS }} | |
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
- name: 🗃️ Rename the Release File | |
run: cp ${{ steps.sign_app_apk.outputs.signedReleaseFile }} ${{ github.workspace }}/app-release.apk | |
- name: 📄 Extract Version Number | |
id: flutter-version | |
uses: NiklasLehnfeld/flutter-version-number-action@main | |
with: | |
file-path: ${{ github.workspace }}/pubspec.yaml | |
- name: ✂️ Split Version Number | |
uses: jungwinter/split@v1 | |
id: flutter-version-split | |
with: | |
msg: ${{ steps.flutter-version.outputs.version-number }} | |
seperator: '+' | |
- name: ⬆️ Github Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ steps.flutter-version-split.outputs._0 }} | |
tag_name: ${{ steps.flutter-version-split.outputs._0 }} | |
body_path: ${{ github.workspace }}/fastlane/metadata/android/en-US/changelogs/${{ steps.flutter-version-split.outputs._1 }}.txt | |
draft: true | |
files: "${{ github.workspace }}/app-release.apk" | |
fail_on_unmatched_files: true |