-
Notifications
You must be signed in to change notification settings - Fork 28
164 lines (146 loc) · 5.85 KB
/
build.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Build
on:
push:
paths-ignore:
- '*.md'
- '*.txt'
pull_request:
workflow_dispatch:
inputs:
release:
description: 'Release'
type: boolean
required: true
default: false
lspatch:
description: 'LSPatch'
type: boolean
required: true
default: false
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set environments
run: |
{
echo "packageId=$(grep namespace app/build.gradle | awk '{print $2}' | tr -d \')"
echo "versionName=v$(grep versionName app/build.gradle | awk '{print $2}' | tr -d \")"
echo "versionCode=$(grep versionCode app/build.gradle | awk '{print $2}')"
echo "LINE_versionName=$(echo '${{ env.line_ver_code }}' | awk '{print substr($0,1,2)"."substr($0,3,2)"."int(substr($0,5,1))}')"
echo "LINE_versionCode=$(grep HOOK_TARGET_VERSION app/build.gradle | awk '{print $4}' | tr -d \'\")"
echo "commit=$(echo ${{ github.sha }} | cut -c-7)"
echo "repo=$(echo ${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/})"
} >> $GITHUB_ENV
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Get previous version name
uses: oprypin/find-latest-tag@v1
if: github.event.inputs.release == 'true'
id: previous
with:
repository: ${{ github.repository }}
releases-only: true
- name: Release check
if: github.event.inputs.release == 'true'
run: |
if [ "${{ secrets.STORE_FILE }}" == "" ]; then
echo -e "\nERROR!\nTo release, you need to set up a signing key!\n"
echo "STORE_FILE: A Base64 encoded string of the signing key in JKS format"
echo "STORE_PASSWORD: Key store password"
echo "KEY_ALIAS: Key alias"
echo "KEY_PASSWORD: Key password"
echo ""
exit 1
fi
if [ "${{ steps.previous.outputs.tag }}" == "${{ env.versionName }}" ]; then
echo -e "\nERROR!\nThe same tag already exists!\n"
echo "Please change versionName in build.gradle"
echo ""
exit 1
fi
- name: Build module
run: |
if [ "${{ inputs.release }}" == "true" ]; then
echo "${{ secrets.STORE_FILE }}" | base64 -d > app/release.jks
export STORE_PASSWORD="${{ secrets.STORE_PASSWORD }}"
export KEY_ALIAS="${{ secrets.KEY_ALIAS }}"
export KEY_PASSWORD="${{ secrets.KEY_PASSWORD }}"
./gradlew assembleRelease --no-daemon --stacktrace
cp -f app/build/outputs/apk/release/app-release.apk ${{ env.repo }}-${{ env.versionName }}.apk
else
./gradlew assembleDebug --no-daemon --stacktrace
fi
- name: LSPatch
if: github.event.inputs.lspatch == 'true'
run: |
cat << EOF > conf
https://github.com/JingMatrix/LSPatch/releases/latest/download/lspatch.jar
out=lspatch.jar
https://line-android-universal-download.line-scdn.net/line-${{ env.LINE_versionName }}.apk
out=line-${{ env.LINE_versionName }}.apk
EOF
echo "Downloading APK..."
aria2c --no-conf -x16 -s16 -R -m0 -V --async-dns=false -iconf
echo "Patching LIME..."
java -jar lspatch.jar "line-${{ env.LINE_versionName }}.apk" -m "app/build/outputs/apk/debug/app-debug.apk" -l 2 -v
- name: Upload module
uses: actions/upload-artifact@v4
if: github.event.inputs.release != 'true'
with:
name: ${{ env.repo }}-${{ env.versionName }}@${{ env.commit }}
path: app/build/outputs/apk/debug/app-debug.apk
if-no-files-found: error
- name: Upload patched APK
uses: actions/upload-artifact@v4
if: github.event.inputs.lspatch == 'true'
with:
name: LINE-${{ env.LINE_versionName }}@${{ env.commit }}
path: line-${{ env.LINE_versionName }}-*-lspatched.apk
if-no-files-found: error
- name: Release original repository
uses: softprops/action-gh-release@v2
if: github.event.inputs.release == 'true'
with:
tag_name: ${{ env.versionName }}
draft: false
prerelease: false
make_latest: true
discussion_category_name: Announcements
generate_release_notes: true
files: ${{ env.repo }}-${{ env.versionName }}.apk
fail_on_unmatched_files: true
body: |
# 更新内容
## 対応するLINEのバージョン
${{ env.LINE_versionName }}
### 差分
https://github.com/${{ github.repository }}/compare/${{ steps.previous.outputs.tag }}...${{ env.versionName }}
- name: Release to Xposed repository
uses: softprops/action-gh-release@v2
if: github.event.inputs.release == 'true'
with:
repository: Xposed-Modules-Repo/${{ env.packageId }}
tag_name: ${{ env.versionCode }}-${{ env.versionName }}
draft: false
prerelease: false
make_latest: true
files: ${{ env.repo }}-${{ env.versionName }}.apk
body: |
## Details
https://github.com/${{ github.repository }}/releases/${{ env.versionName }}
## Supported LINE version
${{ env.LINE_versionName }}
### Diff
https://github.com/${{ github.repository }}/compare/${{ steps.previous.outputs.tag }}...${{ env.versionName }}