-
Notifications
You must be signed in to change notification settings - Fork 751
62 lines (51 loc) · 1.69 KB
/
release.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
name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 代码迁出
uses: actions/checkout@v4
- name: 构建Java环境
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "17"
- name: 解码生成 jks
run: echo $KEYSTORE_BASE64 | base64 -di > app/keystore.jks
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
- name: 生成apk
run: chmod +x ./gradlew && ./gradlew assembleRelease
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}
- name: 获取版本号
id: version
run: echo "version=${GITHUB_REF#refs/tags/v}" >>$GITHUB_OUTPUT
- name: 重命名应用
run: |
for file in app/build/outputs/apk/release/app-*.apk; do
if [[ $file =~ app-(.?*)release.apk ]]; then
new_file_name="app/build/outputs/apk/release/mytv-android-${BASH_REMATCH[1]}${{ steps.version.outputs.version }}.apk"
mv "$file" "$new_file_name"
fi
done
- name: Prepare artifacts
run: |
mkdir artifacts
cp app/build/outputs/apk/release/*.apk artifacts/
- name: Upload Release
uses: ncipollo/release-action@v1
with:
name: v${{ steps.version.outputs.version }}
token: ${{ secrets.GIT_TOKEN }}
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
allowUpdates: true
artifacts: artifacts/*