This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
133 lines (111 loc) · 4.24 KB
/
release.yaml
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Release
on:
push:
branches:
- "master"
paths:
- "CHANGELOG.md"
workflow_dispatch:
jobs:
go:
runs-on: ubuntu-latest
strategy:
matrix:
GO_ARCH: [ "386", amd64, arm, arm64 ]
steps:
- uses: actions/checkout@v3
- name: Download AList Source Code
run: |
cd $GITHUB_WORKSPACE/alist-lib/scripts
chmod +x *.sh
./init_alist_core.sh
./init_alist_web.sh
- uses: actions/setup-go@v4
with:
go-version: 1.21.5
cache-dependency-path: ${{ github.workspace }}/alist-lib/go.sum
- name: Build
run: |
cd $GITHUB_WORKSPACE/alist-lib
GOARCH=${{ matrix.GO_ARCH }}
declare -A goarch2cc=( ["arm64"]="aarch64-linux-android32-clang" ["arm"]="armv7a-linux-androideabi32-clang" ["amd64"]="x86_64-linux-android32-clang" ["386"]="i686-linux-android32-clang")
export CC="$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/${goarch2cc[$GOARCH]}"
declare -A arch2lib=( ["arm64"]="arm64-v8a" ["arm"]="armeabi-v7a" ["amd64"]="x86_64" ["386"]="x86")
export LIB="${arch2lib[$GOARCH]}"
./scripts/install_alist.sh $GOARCH $LIB
- name: Upload to Artifact
uses: actions/upload-artifact@v3
with:
name: "app_libs"
path: "${{ github.workspace }}/app/libs"
android:
runs-on: ubuntu-latest
needs: [ go ]
env:
output: "${{ github.workspace }}/app/build/outputs/apk/release"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/[email protected]
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: "app_libs"
path: "${{ github.workspace }}/app/libs"
- name: Init Signature
run: |
touch local.properties
echo ALIAS_NAME='${{ secrets.ALIAS_NAME }}' >> local.properties
echo ALIAS_PASSWORD='${{ secrets.ALIAS_PASSWORD }}' >> local.properties
echo KEY_PASSWORD='${{ secrets.KEY_PASSWORD }}' >> local.properties
echo KEY_PATH='./key.jks' >> local.properties
# 从Secrets读取无换行符Base64解码, 然后保存到到app/key.jks
echo ${{ secrets.KEY_STORE }} | base64 --decode > $GITHUB_WORKSPACE/app/key.jks
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
id: gradle
run: ./gradlew assembleRelease -build-cache --parallel --daemon --warning-mode all
- name: Upload missing_rules.txt
if: failure() && steps.gradle.outcome != 'success'
uses: actions/upload-artifact@v3
with:
name: "missing_rules"
path: "${{ github.workspace }}/app/build/outputs/mapping/release/missing_rules.txt"
- name: Init APP Version Name
run: |
echo "ver_name=$(grep -m 1 'versionName' ${{ env.output }}/output-metadata.json | cut -d\" -f4)" >> $GITHUB_ENV
- name: Upload App To Artifact arm64-v8a
if: success () || failure ()
uses: actions/upload-artifact@v3
with:
name: "AListAndroid-v${{ env.ver_name }}_arm64-v8a"
path: "${{ env.output }}/*-v8a.apk"
- name: Upload App To Artifact arm-v7a
if: success () || failure ()
uses: actions/upload-artifact@v3
with:
name: "AListAndroid-v${{ env.ver_name }}_arm-v7a"
path: "${{ env.output }}/*-v7a.apk"
- name: Upload App To Artifact x86
if: success () || failure ()
uses: actions/upload-artifact@v3
with:
name: "AListAndroid-v${{ env.ver_name }}_x86"
path: "${{ env.output }}/*_x86.apk"
- uses: softprops/[email protected]
with:
name: ${{ env.ver_name }}
tag_name: ${{ env.ver_name }}
body_path: ${{ github.workspace }}/CHANGELOG.md
draft: false
prerelease: false
files: ${{ env.output }}/*.apk
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}