Skip to content

fix: android cd

fix: android cd #101

name: Deploy Android
on:
push:
branches:
- develop
workflow_dispatch:
jobs:
build:
env:
FLUTTER_VERSION:
FLUTTER_CHANNEL:
FLUTTER_HOME:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
# https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up ssh
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_ID_ED25519 }}" | base64 -d > ~/.ssh/id_ed25519
chmod 700 ~/.ssh/id_ed25519
eval $(ssh-agent -s)
echo "Host github.com \n\tIdentityFile ~/.ssh/id_ed25519\n\tUser git\n\tIdentityiesOnly yes" >> ~/.ssh/config
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
- uses: actions/setup-java@v4
with:
distribution: "oracle"
java-version: "17"
# https://github.com/kuhnroyal/flutter-fvm-config-action
- name: Fetch flutter config
uses: kuhnroyal/flutter-fvm-config-action@v2
# https://github.com/subosito/flutter-action
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
- name: Setup melos
run: |
ln -s $FLUTTER_ROOT .fvm/flutter_sdk
dart pub global activate melos
melos bootstrap
- name: build_runner
run: |
echo '${{ secrets.ENV }}' | base64 -d > app/.env
melos generate
- name: Accept Android License
run: yes | flutter doctor --android-licenses
- name: Extract keystore
run: |
echo '${{ secrets.SIGNING_KEY }}' | base64 -d > app/android/app/key.jks
echo '${{ secrets.FIREBASE_ANDROID }}' | base64 -d > app/android/app/google-services.json
echo '${{ secrets.KEY_PROPERTIES }}' | base64 -d > app/android/key.properties
- name: Build aab
working-directory: app
run: flutter build appbundle --release
- name: Upload artifact aab
uses: actions/upload-artifact@v1.0.0
with:
name: release-android
path: app/build/app/outputs/bundle/release/app-release.aab
#-- Slack通知 --#
# 成功
- name: Slack Notification on Success
if: ${{ success() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_TITLE: Android CI Success
SLACK_COLOR: good
SLACK_ICON: https://github.com/YumNumm/EQMonitor/blob/6bedf4314134ecf614654f7284841390d3d0a4f3/assets/images/icon.png?raw=true
SLACK_USERNAME: EQMonitor
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
# 失敗
- name: Slack Notification on Failure
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_TITLE: Android CI Failure
SLACK_COLOR: danger
SLACK_ICON: https://github.com/YumNumm/EQMonitor/blob/6bedf4314134ecf614654f7284841390d3d0a4f3/assets/images/icon.png?raw=true
SLACK_USERNAME: EQMonitor
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
upload:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact aab
uses: actions/download-artifact@v4
with:
name: release-android
path: out.aab
- name: Upload to Google Play
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
packageName: net.yumnumm.eqmonitor
releaseFiles: out.aab
track: internal
status: inProgress