-
Notifications
You must be signed in to change notification settings - Fork 49
49 lines (47 loc) · 1.4 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# 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/release-action@v1.5.0
with:
artifacts: "build/app/outputs/flutter-apk/*.apk"
token: ${{ secrets.RELEASE_TOKEN }}