Skip to content

补上版本号

补上版本号 #24

Workflow file for this run

name: Build and Release APK
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release'
required: true
default: 'v0.0.0'
skip_release:
description: 'Skip creating release?'
required: false
default: 'false'
permissions:
contents: write
jobs:
build:
name: Build APK
runs-on: ubuntu-latest
env:
TZ: Asia/Shanghai
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Timezone
run: |
sudo timedatectl set-timezone Asia/Shanghai
date
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Get Dependencies
run: flutter pub get
- name: Decode Firebase Options
env:
FIREBASE_OPTIONS_BASE64: ${{ secrets.FIREBASE_OPTIONS_BASE64 }}
run: |
echo $FIREBASE_OPTIONS_BASE64 | base64 -d > lib/firebase_options.dart
- name: Decode Google Services Json
env:
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
run: |
echo $GOOGLE_SERVICES_JSON_BASE64 | base64 -d > android/app/google-services.json
- name: Check Files
run: |
ls -l android/app/google-services.json || echo "google-services.json NOT FOUND"
ls -l lib/firebase_options.dart || echo "firebase_options.dart NOT FOUND"
- name: Build Fat APK (Universal)
run: |
flutter build apk --release
mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/CQUT-Helper-universal.apk
- name: Build Split APKs
run: flutter build apk --release --split-per-abi
- name: Create Release
uses: softprops/action-gh-release@v1
if: |
(startsWith(github.ref, 'refs/tags/') ||
github.event_name == 'workflow_dispatch') &&
(github.event_name != 'workflow_dispatch' || github.event.inputs.skip_release == 'false')
with:
tag_name: ${{ github.ref_name || github.event.inputs.tag_name }}
name: Release ${{ github.ref_name || github.event.inputs.tag_name }}
files: |
build/app/outputs/flutter-apk/CQUT-Helper-universal.apk
build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
generate_release_notes: true
# 设置为 true,这样发布后会是草稿状态,你可以手动编辑 Release 说明后再正式发布
draft: true
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}