-
Notifications
You must be signed in to change notification settings - Fork 82
114 lines (102 loc) · 3.62 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: release
on:
push:
tags:
- '**'
workflow_dispatch:
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/[email protected]
with:
submodules: recursive
token: ${{ secrets.TOKEN }}
- name: Checkout Private
uses: actions/checkout@v4
with:
repository: 'easybangumiorg/EasyBangumiPrivate'
token: ${{ secrets.TOKEN }}
path: 'private'
ref: main
- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: 17
# Gradle 缓存配置
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
env:
RELEASE: true
- name: Build
run: |
ls private
cp ./private/google-services.json ./app/google-services.json
ls app
chmod +x ./gradlew
./gradlew :app:assembleRelease
env:
APPCENTER_SECRET: ${{ secrets.APPCENTER_SECRET }}
BUGLY_APPID: ${{ secrets.BUGLY_APPID }}
RELEASE: true
- name: Get Version
id: getVersion
run: |
echo "JSON file content:"
cat app/build/outputs/apk/release/output-metadata.json
echo "VERSION=$(jq -r '.elements[0].versionName' app/build/outputs/apk/release/output-metadata.json)" >> $GITHUB_ENV
- name: Setup build tool version variable
shell: bash
run: |
echo ${{ env.VERSION }}
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1)
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
echo Last build tool version is: $BUILD_TOOL_VERSION
- name: sign-apk
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PWD }}
keyPassword: ${{ secrets.KEY_PWD }}
env:
# override default build-tools version (29.0.3) -- optional
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }}
- name: rename-apk
run: |
mv app/build/outputs/apk/release/app-release-unsigned-signed.apk easybangumi-${{ env.VERSION }}.apk
- name: Archive apk
uses: actions/upload-artifact@v4
with:
name: easybangumi-${{ env.VERSION }}.apk
path: easybangumi-${{ env.VERSION }}.apk
compression-level: 0
- name: Release
run: |
gh release create -d ${{ env.VERSION }} easybangumi-${{ env.VERSION }}.apk
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
- name: push_mapping
if: ${{ env.VERSION }} != "" && ${{ env.VERSION }} != "."
run: |
cd private
mkdir -p ./mapping/${{ env.VERSION }}
mv -b --suffix=.old ../app/build/outputs/mapping/release/* ./mapping/${{ env.VERSION }}
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "[auto] mapping"
- name: Push changes
uses: ad-m/github-push-action@master
with:
force: true
github_token: ${{ secrets.token }}
branch: main
directory: private
repository: 'easybangumiorg/EasyBangumiPrivate'