fix: deploy workflow #30
Workflow file for this run
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: Deploy Android | |
on: | |
push: | |
branches: | |
- develop | |
- fix/ios-deploy | |
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 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 }} |