Tag Release #40
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: Tag Release | |
on: | |
push: | |
tags: | |
- "v*" | |
workflow_dispatch: | |
jobs: | |
release-android: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
target: | |
[ | |
"android-arm", | |
"android-arm64", | |
"android-x64", | |
"android-all", | |
"android-aab", | |
] | |
env: | |
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | |
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} | |
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
ALIAS: ${{ secrets.ALIAS }} | |
KEY_PATH: key.jks | |
FLUTTER_VERSION: | |
FLUTTER_CHANNEL: | |
FLUTTER_HOME: | |
CI_ACTION_REF_NAME: | |
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: Accept Android License | |
run: yes | flutter doctor --android-licenses | |
- name: Extract Environment Variables | |
run: | | |
echo '${{ secrets.SIGNING_KEY }}' | base64 -d > android/app/key.jks | |
echo '${{ secrets.FIREBASE_ANDROID }}' | base64 -d > android/app/google-services.json | |
echo '${{ secrets.KEY_PROPERTIES }}' | base64 -d > android/key.properties | |
- name: Build APK | |
if: ${{ matrix.target }} != "android-all" && ${{ matrix.target }} != "android-aab" | |
working-directory: app | |
run: flutter build apk --release --target-platform=${{ matrix.target }} | |
- name: Build APK (All Targets) | |
if: ${{ matrix.target }} == "android-all" | |
working-directory: app | |
run: flutter build apk --release | |
- name: Build AAB | |
if: ${{ matrix.target }} == "android-aab" | |
working-directory: app | |
run: flutter build appbundle --release | |
- name: Upload artifact | |
uses: actions/[email protected] | |
if: ${{ matrix.target }} != "android-aab" | |
with: | |
name: EQMonitor-${{ matrix.target }}.apk | |
path: app/build/app/outputs/flutter-apk/app-release.apk | |
- name: Upload artifact (AAB) | |
uses: actions/[email protected] | |
if: ${{ matrix.target }} == "android-aab" | |
with: | |
name: EQMonitor-${{ matrix.target }}.aab | |
path: app/build/app/outputs/bundle/release/app-release.aab | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: EQMonitor-${{ matrix.target }}.apk | |
name: v${{ env.CI_ACTION_REF_NAME }} | |
draft: true | |
- name: Release (AAB) | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') && ${{ matrix.target }} == "android-aab" | |
with: | |
files: EQMonitor-${{ matrix.target }}.aab | |
name: v${{ env.CI_ACTION_REF_NAME }} | |
draft: true | |
#-- Slack通知 --# | |
# 成功 | |
- name: Slack Notification on Success | |
if: ${{ success() }} | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_TITLE: Deploy Success | |
SLACK_COLOR: good | |
SLACK_ICON: https://raw.githubusercontent.com/EQMonitor/EQMonitor/main/assets/icon.png | |
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: Deploy Failure | |
SLACK_COLOR: danger | |
SLACK_ICON: https://raw.githubusercontent.com/EQMonitor/EQMonitor/main/assets/icon.png | |
SLACK_USERNAME: EQMonitor | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} |