-
Notifications
You must be signed in to change notification settings - Fork 24
85 lines (73 loc) · 2.56 KB
/
android.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Android CI & Create Release
# 触发条件: 这里是push以”v“开头的tag触发
on:
push:
# 根据branch或者tags来触发
branches:
- master
tags:
- "v*"
# 忽略的标签类型,不触发构建流程(和tags不能同时写)
# tags-ignore:
# - "d*"
# strategy:
# 矩阵使用: ${{ matrix.os }}
# 下面两个矩阵,会代码就会执行 2 * 3 = 6次
# matrix:
# os: [ubuntu-16.04, ubuntu-18.04]
# node: [6, 8, 10]
# 一次持续集成的运行,可以完成多个任务(下面就build)
jobs:
builds:
runs-on: ubuntu-latest
# 可以依赖其他job
# needs: xxxJob、[job1, job2]
# 构建权限,ncipollo/release-action需要使用
permissions:
contents: write
# 操作步骤(按顺序执行)
steps:
- uses: actions/checkout@v3
# 设置 Java8 运行环境(temurin是开源jdk)
- name: Set up Gradle JDK 11
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
# 设置 gradle 7.5 环境(跟工程 gradle目录下的版本要一致)
- uses: gradle/gradle-build-action@v2
with:
gradle-version: 7.5
arguments: assembleRelease
# 签名apk
- uses: r0adkll/sign-android-release@v1
name: Sign app APK
id: sign_app
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
# 还能设置build-tools version,29.0.3好像不支持了
env:
# override default build-tools version (29.0.3) -- optional
BUILD_TOOLS_VERSION: "28.0.3"
# build-tools可能不存在,用step查看下支持哪些
- run: ls /usr/local/lib/android/sdk/build-tools/
# 重命名apk
# GITHUB_REF_NAME是“触发workflow的分支或tag名称”
- run: mv ${{steps.sign_app.outputs.signedReleaseFile}} iMoney_android_$GITHUB_REF_NAME.apk
# 可以指定shell命令的执行目录
# working-directory: ./temp
# 只当shell的类型
# shell: bash
# 发布
- uses: ncipollo/release-action@v1
with:
# 要包含到Release Assets中的文件
artifacts: "*.apk"
# 会使用一个临时的token来创建Release
token: ${{ github.token }}
# 自动生成一些变化列表之类的内容。
generateReleaseNotes: true