-
-
Notifications
You must be signed in to change notification settings - Fork 19
177 lines (154 loc) · 5.81 KB
/
build_pull_request.yml
File metadata and controls
177 lines (154 loc) · 5.81 KB
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
165
166
167
168
169
170
171
172
173
174
175
176
177
name: PR check
on:
pull_request:
paths:
- '**'
- '!**.md'
- '!.github/**'
- '.github/workflows/**'
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
env:
CI_CHUNK_SIZE: 15
IS_PR_CHECK: true
jobs:
prepare:
name: Prepare job
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
matrix: ${{ steps.generate-matrices.outputs.matrix }}
delete: ${{ steps.generate-matrices.outputs.delete }}
steps:
- name: Checkout PR
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: Set env
id: set-env
run: |
echo "LATEST_COMMIT_MESSAGE<<{delimiter}
$(git log -1 --pretty=%B)
Built on commit: $(git log -1 --pretty=%H)
{delimiter}" >> $GITHUB_OUTPUT
- name: Find lib changes
id: modified-libs
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5
with:
files: lib/
files_ignore: lib/**.md
files_separator: " "
safe_output: false
# This step is to alert whether a bumping version might occur.
- name: Bump extensions that uses a modified lib
if: steps.modified-libs.outputs.any_changed == 'true'
env:
COMMIT_MESSAGE: ${{ steps.set-env.outputs.LATEST_COMMIT_MESSAGE }}
run: |
latest_commit_author=$(git log -1 --pretty=%an)
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
chmod +x ./.github/scripts/bump-versions.py
./.github/scripts/bump-versions.py "$COMMIT_MESSAGE" ${{ steps.modified-libs.outputs.all_changed_files }}
echo "!!! This PR will bumping extensions version that uses a modified lib"
- id: generate-matrices
name: Generate build matrices
run: |
python ./.github/scripts/generate-build-matrices.py origin/master ${{ secrets.SIGNING_KEY != '' && 'Release' || 'Debug' }}
build:
name: Build extensions (${{ matrix.chunk.number }})
needs: prepare
runs-on: ubuntu-latest
timeout-minutes: 30
if: ${{ toJson(fromJson(needs.prepare.outputs.matrix).chunk) != '[]' }}
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
steps:
- name: Checkout PR
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
java-version: 17
distribution: temurin
- name: Set up Gradle
uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2
with:
cache-read-only: true
- name: Prepare signing key
run: |
echo ${{ secrets.SIGNING_KEY }} | base64 -d > signingkey.jks
chmod 600 signingkey.jks
- name: Build extensions (${{ matrix.chunk.number }})
env:
ALIAS: ${{ secrets.ALIAS }}
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
MEGACLOUD_API: ${{ secrets.MEGACLOUD_API }}
KISSKH_API: ${{ secrets.KISSKH_API }}
KISSKH_SUB_API: ${{ secrets.KISSKH_SUB_API }}
KAISVA: ${{ secrets.KAISVA }}
TMDB_API: ${{ secrets.TMDB_API }}
MODULES: ${{ join(matrix.chunk.modules, ' ') }}
run: |
./gradlew $MODULES
- name: Upload APKs (${{ matrix.chunk.number }})
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: github.repository == github.event.pull_request.head.repo.full_name
with:
name: "individual-apks-${{ matrix.chunk.number }}"
path: "**/*.apk"
retention-days: 1
- name: Clean up CI files
run: rm signingkey.jks
publish:
name: Check extension repo
needs: [prepare, build]
if: github.repository == github.event.pull_request.head.repo.full_name
runs-on: 'ubuntu-24.04'
steps:
- name: Download APK artifacts
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
path: ~/apk-artifacts
- name: Set up JDK
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
java-version: 17
distribution: temurin
- name: Checkout PR
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
path: PR
fetch-depth: 0
persist-credentials: false
- name: Create repo artifacts
run: |
cd PR
python ./.github/scripts/move-built-apks.py
INSPECTOR_LINK="$(curl -s "https://api.github.com/repos/komikku-app/aniyomi-extensions-inspector/releases/latest" | jq -r '.assets[0].browser_download_url')"
curl -L "$INSPECTOR_LINK" -o ./Inspector.jar
java -jar ./Inspector.jar "repo/apk" "output.json" "tmp"
python ./.github/scripts/create-repo.py
- name: Checkout repo branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: yuzono/anime-repo
ref: repo
path: repo
fetch-depth: 0
persist-credentials: false
- name: Merge repo
run: |
cd repo
python ../PR/.github/scripts/merge-repo.py '${{ needs.prepare.outputs.delete }}' 'PR/repo'
# Showing which extensions are to be updated with this PR
- name: Check Deploy repo
run: |
cd repo
git status