Test, Build and Release apk #65
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
# main.yml | |
# 自动构建 Apk | |
name: Test, Build and Release apk | |
# 工作流程触发的时机,这里是当一个版本标签推送到仓库时触发 | |
on: | |
push: | |
tags: | |
- v* | |
# 这个工作流程需要执行的任务 | |
jobs: | |
process: | |
name: all process | |
runs-on: ubuntu-latest | |
# 这个任务的步骤 | |
steps: | |
# 拉取项目代码 | |
- uses: actions/checkout@v2 | |
# 建立 java 环境 | |
- name: Setup Java JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '19' | |
cache: 'gradle' | |
# 建立 Flutter 环境 | |
- name: Flutter action | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
flutter-version: "3.22.2" | |
# 下载项目依赖 | |
- run: flutter pub get | |
- run: echo $ENCODED_KEYSTORE | base64 -di > android/app/keystore.jks | |
env: | |
ENCODED_KEYSTORE: ${{ secrets.ENCODED_KEYSTORE }} | |
# 打包 APK | |
- run: flutter build apk --release --flavor=github | |
env: | |
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}} | |
# 发布到 Release | |
- name: Release apk | |
uses: ncipollo/[email protected] | |
with: | |
artifacts: "build/app/outputs/flutter-apk/*.apk" | |
token: ${{ secrets.RELEASE_TOKEN }} |