Skip to content

Auto format - ref: develop (#638) #24

Auto format - ref: develop (#638)

Auto format - ref: develop (#638) #24

name: Deploy Android
on:
push:
branches: [main, develop, release/*]
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: pocket-apps/action-setup-firebase@v2
with:
firebase-token: ${{ secrets.FIREBASE_TOKEN }}
# 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 apk
working-directory: app
run: flutter build apk --release
- name: Upload artifact aab
uses: actions/[email protected]
with:
name: release-android
path: app/build/app/outputs/flutter-apk/app-release.apk
#-- 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 }}