-
Notifications
You must be signed in to change notification settings - Fork 59
339 lines (278 loc) · 17.2 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
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
name: Release
on:
push:
tags: [ 'v*' ]
jobs:
create-release:
name: Create Release
runs-on: ubuntu-22.04
steps:
- name: Get Tag # usage: ${{ steps.tag.outputs.tag }}
id: tag
uses: dawidd6/action-get-tag@v1
- uses: bhowell2/[email protected]
id: tag-version # usage: ${{ steps.tag-version.outputs.substring }}
with:
value: ${{ steps.tag.outputs.tag }}
index_of_str: "v"
default_return_value: ${{ steps.tag.outputs.tag }}
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.tag }}
name: ${{ steps.tag-version.outputs.substring }}
# 修改 release-template.md 然后复制过来
body: |
Automatically created from tag ${{ steps.tag.outputs.tag }}. Do not change anything until assets are
uploaded.
----
### 下载
<details>
<summary>>> <h3>点我展开下载列表</h3> <<</summary>
[//]: # (注意, `checkLatestVersion` 有字符串处理, 修改标题和分隔符前务必查询)
[github-win-x64]: https://github.com/open-ani/ani/releases/download/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-windows-x86_64.zip
[github-mac-x64]: https://github.com/open-ani/ani/releases/download/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-macos-x86_64.dmg
[github-mac-aarch64]: https://github.com/open-ani/ani/releases/download/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-macos-aarch64.dmg
[github-android]: https://github.com/open-ani/ani/releases/download/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-universal.apk
[github-android-arm64-v8a]: https://github.com/open-ani/ani/releases/download/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-arm64-v8a.apk
[github-android-armeabi-v7a]: https://github.com/open-ani/ani/releases/download/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-armeabi-v7a.apk
[github-android-x86_64]: https://github.com/open-ani/ani/releases/download/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-x86_64.apk
[cf-win-x64]: https://d.myani.org/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-windows-x86_64.zip
[cf-mac-x64]: https://d.myani.org/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-macos-x86_64.dmg
[cf-mac-aarch64]: https://d.myani.org/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-macos-aarch64.dmg
[cf-android]: https://d.myani.org/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-universal.apk
[cf-android-arm64-v8a]: https://d.myani.org/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-arm64-v8a.apk
[cf-android-armeabi-v7a]: https://d.myani.org/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-armeabi-v7a.apk
[cf-android-x86_64]: https://d.myani.org/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-x86_64.apk
[ghproxy-win-x64]: https://mirror.ghproxy.com/?q=https%3A%2F%2Fgithub.com%2Fopen-ani%2Fani%2Freleases%2Fdownload%2F${{steps.tag.outputs.tag}}%2Fani-${{steps.tag-version.outputs.substring}}-windows-x86_64.zip
[ghproxy-mac-x64]: https://mirror.ghproxy.com/?q=https%3A%2F%2Fgithub.com%2Fopen-ani%2Fani%2Freleases%2Fdownload%2F${{steps.tag.outputs.tag}}%2Fani-${{steps.tag-version.outputs.substring}}-macos-x86_64.dmg
[ghproxy-mac-aarch64]: https://mirror.ghproxy.com/?q=https%3A%2F%2Fgithub.com%2Fopen-ani%2Fani%2Freleases%2Fdownload%2F${{steps.tag.outputs.tag}}%2Fani-${{steps.tag-version.outputs.substring}}-macos-aarch64.dmg
[ghproxy-android]: https://mirror.ghproxy.com/?q=https%3A%2F%2Fgithub.com%2Fopen-ani%2Fani%2Freleases%2Fdownload%2F${{steps.tag.outputs.tag}}%2Fani-${{steps.tag-version.outputs.substring}}-universal.apk
[ghproxy-android-arm64-v8a]: https://mirror.ghproxy.com/?q=https%3A%2F%2Fgithub.com%2Fopen-ani%2Fani%2Freleases%2Fdownload%2F${{steps.tag.outputs.tag}}%2Fani-${{steps.tag-version.outputs.substring}}-arm64-v8a.apk
[ghproxy-android-armeabi-v7a]: https://mirror.ghproxy.com/?q=https%3A%2F%2Fgithub.com%2Fopen-ani%2Fani%2Freleases%2Fdownload%2F${{steps.tag.outputs.tag}}%2Fani-${{steps.tag-version.outputs.substring}}-armeabi-v7a.apk
[ghproxy-android-x86_64]: https://mirror.ghproxy.com/?q=https%3A%2F%2Fgithub.com%2Fopen-ani%2Fani%2Freleases%2Fdownload%2F${{steps.tag.outputs.tag}}%2Fani-${{steps.tag-version.outputs.substring}}-x86_64.apk
[qb-enhanced]: https://github.com/c0re100/qBittorrent-Enhanced-Edition/releases/latest
- PC 首次播放在线数据源时, 可能需要加载 10-30 秒。
- macOS
安装后如果无法打开: [解决方案](https://github.com/open-ani/ani/wiki/macOS-%E6%97%A0%E6%B3%95%E6%89%93%E5%BC%80%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88)
- Windows
打开时如果显示异常: [解决方案](https://github.com/open-ani/ani/wiki/Windows-%E4%B8%8B%E5%AD%97%E4%BD%93%E4%B8%8E%E8%83%8C%E6%99%AF%E9%A2%9C%E8%89%B2%E5%BC%82%E5%B8%B8)
| 操作系统 | 全球 | 中国大陆 |
|------------------------------------|--------------------------------------|------------------------------------------------------------------|
| Windows x86_64 | [GitHub][github-win-x64] | [主线][cf-win-x64] / [备线][ghproxy-win-x64] |
| macOS x86_64 (Intel 芯片) | [GitHub][github-mac-x64] | [主线][cf-mac-x64] / [备线][ghproxy-mac-x64] |
| macOS aarch64 (M 系列芯片) | [GitHub][github-mac-aarch64] | [主线][cf-mac-aarch64] / [备线][ghproxy-mac-aarch64] |
| Android universal (适用于所有设备) | [GitHub][github-android] | [主线][cf-android] / [备线][ghproxy-android] |
| Android arm64-v8a (仅新手机) | [GitHub][github-android-arm64-v8a] | [主线][cf-android-arm64-v8a] / [备线][ghproxy-android-arm64-v8a] |
| Android armeabi-v7a (仅 32 位旧手机和电视) | [GitHub][github-android-armeabi-v7a] | [主线][cf-android-armeabi-v7a] / [备线][ghproxy-android-armeabi-v7a] |
| Android x86_64 (Chromebook 及模拟器) | [GitHub][github-android-x86_64] | [主线][cf-android-x86_64] / [备线][ghproxy-android-x86_64] |
也可以扫描二维码下载 Android 版本 (适用于所有设备):
[github-android-qr]: https://github.com/open-ani/ani/releases/download/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-universal.apk.github.qrcode.png
[cf-android-qr]: https://d.myani.org/${{steps.tag.outputs.tag}}/ani-${{steps.tag-version.outputs.substring}}-universal.apk.cloudflare.qrcode.png
| 全球 | 中国大陆 |
|------------------------------|------------------------------|
| ![GitHub][github-android-qr] | ![Cloudflare][cf-android-qr] |
</details>
draft: true
prerelease: ${{ contains(steps.tag.outputs.tag, '-') }}
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
id: ${{ steps.create_release.outputs.id }}
release:
needs: [ create-release ]
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- windows-2019
# - ubuntu-20.04
- macos-13 # x86_64
- macos-14 # aarch64
include:
# matrix properties can be booleans. Check for plain true and false.
- os: windows-2019
name: Windows x86_64
uploadApk: false
arch: x64
anitorrent: true
anitorrent_separate_build: false # windows 单线程构建 anitorrent, 要一起跑节约时间
compose_resource_triple: windows-x64
run_tests: true
gradleArgs: '"-Dorg.gradle.jvmargs=-Xmx4096m" "-Dfile.encoding=UTF-8" "-Dkotlin.daemon.jvm.options=-Xmx4096M"'
- os: macos-13
name: macOS x86_64
uploadApk: true
arch: x64
anitorrent: true
anitorrent_separate_build: true # macOS 构建快, 先构建 anitorrent, 再 assemble
compose_resource_triple: macos-x64
run_tests: true
gradleArgs: >-
-Dorg.gradle.jvmargs=-Xmx4096m
-Dfile.encoding=UTF-8
-Dkotlin.daemon.jvm.options=-Xmx4096M
-Pani.build.framework=false
- os: macos-14
name: macOS aarch64
uploadApk: false
arch: aarch64
anitorrent: true
anitorrent_separate_build: true
compose_resource_triple: macos-arm64
run_tests: true
gradleArgs: >-
-Dorg.gradle.jvmargs=-Xmx4096m
-Dfile.encoding=UTF-8
-Dkotlin.daemon.jvm.options=-Xmx4096M
-Pani.build.framework=false
-Pani.android.abis=arm64-v8a
# 这台机器硬盘小, 不要构建其他安卓架构
env:
gradleArgs: >-
--scan
"--no-configuration-cache"
${{ matrix.gradleArgs }}
${{ matrix.anitorrent == true && '"-Dani.enable.anitorrent=true"' || '' }}
${{ matrix.anitorrent == true && '"-DCMAKE_BUILD_TYPE=Release"' || '' }}
${{ startsWith(matrix.os, 'windows') && '"-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake"' || '' }}
${{ startsWith(matrix.os, 'windows') && '"-DBoost_INCLUDE_DIR=C:/vcpkg/installed/x64-windows/include"' || '' }}
isMac: ${{ startsWith(matrix.os, 'macos') }}
isWindows: ${{ startsWith(matrix.os, 'windows') }}
isUbuntu: ${{ startsWith(matrix.os, 'ubuntu') }}
isUnix: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') }}
uploadApk: ${{ matrix.uploadApk == 'true' || matrix.uploadApk == true }}
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- if: ${{ startsWith(matrix.os, 'macos') }}
name: Free space
run: chmod +x ./ci-helper/free-space-macos.sh && ./ci-helper/free-space-macos.sh
continue-on-error: true
- name: Get Tag # usage: ${{ steps.tag.outputs.tag }}
id: tag
uses: dawidd6/action-get-tag@v1
- uses: bhowell2/[email protected]
id: tag-version # usage: ${{ steps.tag-version.outputs.substring }}
with:
value: ${{ steps.tag.outputs.tag }}
index_of_str: "v"
default_return_value: ${{ steps.tag.outputs.tag }}
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
architecture: ${{ matrix.arch }}
- if: ${{ env.isMac == 'true' }}
name: Install Native Dependencies
run: chmod +x ./ci-helper/install-deps-macos-ci.sh && ./ci-helper/install-deps-macos-ci.sh
- if: ${{ env.isWindows == 'true' }}
name: Setup vcpkg cache
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- if: ${{ env.isWindows == 'true' }}
name: Install Native Dependencies
run: ./ci-helper/install-deps-windows.cmd
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-disabled: true # 缓存包含旧版本的, 太占位置了
- if: ${{ env.isUnix == 'true' }}
run: chmod -R 777 *
- name: Update version name
run: ./gradlew updateReleaseVersionNameFromGit ${{ env.gradleArgs }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
CI_RELEASE_ID: ${{ needs.create-release.outputs.id }}
CI_TAG: ${{ steps.tag.outputs.tag }}
# 备注: 这个可能已经不需要了, Compose 可能已经修复了这个 bug
- name: Explicitly generate Compose resources
run: ./gradlew generateComposeResClass ${{ env.gradleArgs }}
- if: ${{ env.uploadApk == 'true' }}
name: Prepare Android Signing Key
id: android_signing_key
uses: timheuer/[email protected]
with:
fileName: 'android_signing_key'
fileDir: './'
encodedString: ${{ secrets.SIGNING_RELEASE_STOREFILE }}
- name: Build Anitorrent
if: ${{ matrix.anitorrent && matrix.anitorrent_separate_build }}
run: ./gradlew :torrent:anitorrent:build :torrent:anitorrent:anitorrent-native:buildAnitorrent ${{ env.gradleArgs }}
# No check. We check in `build.yml`.
- if: ${{ env.uploadApk == 'true' }}
name: Build Android APK
run: ./gradlew assembleRelease ${{ env.gradleArgs }}
env:
"signing_release_storeFileFromRoot": ${{ steps.android_signing_key.outputs.filePath }}
"signing_release_storePassword": ${{ secrets.SIGNING_RELEASE_STOREPASSWORD }}
"signing_release_keyAlias": ${{ secrets.SIGNING_RELEASE_KEYALIAS }}
"signing_release_keyPassword": ${{ secrets.SIGNING_RELEASE_KEYPASSWORD }}
- if: ${{ env.uploadApk == 'true' }}
name: Upload Android APK
run: "./gradlew :ci-helper:uploadAndroidApk ${{ env.gradleArgs }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
CI_RELEASE_ID: ${{ needs.create-release.outputs.id }}
CI_TAG: ${{ steps.tag.outputs.tag }}
UPLOAD_TO_S3: true
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_BASEURL: ${{ secrets.AWS_BASEURL }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_BUCKET: ${{ secrets.AWS_BUCKET }}
- if: ${{ env.uploadApk == 'true' }}
name: Generate QR code for APK (GitHub)
uses: snow-actions/[email protected]
with:
text: https://github.com/Him188/ani/releases/download/${{ steps.tag.outputs.tag }}/ani-${{ steps.tag-version.outputs.substring }}-universal.apk
path: apk-qrcode-github.png
- if: ${{ env.uploadApk == 'true' }}
name: Generate QR code for APK (Cloudflare)
uses: snow-actions/[email protected]
with:
text: https://d.myani.org/${{ steps.tag.outputs.tag }}/ani-${{ steps.tag-version.outputs.substring }}-universal.apk
path: apk-qrcode-cloudflare.png
- if: ${{ env.uploadApk == 'true' }}
name: Upload QR code
run: "./gradlew :ci-helper:uploadAndroidApkQR ${{ env.gradleArgs }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
CI_RELEASE_ID: ${{ needs.create-release.outputs.id }}
CI_TAG: ${{ steps.tag.outputs.tag }}
UPLOAD_TO_S3: true
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_BASEURL: ${{ secrets.AWS_BASEURL }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_BUCKET: ${{ secrets.AWS_BUCKET }}
# createReleaseDistributable
# packageReleaseDistributionForCurrentOS
# packageReleaseUberJarForCurrentOS
# Upload assets for release
- name: Upload Desktop Installers
run: "./gradlew :ci-helper:uploadDesktopInstallers ${{ env.gradleArgs }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
CI_RELEASE_ID: ${{ needs.create-release.outputs.id }}
CI_TAG: ${{ steps.tag.outputs.tag }}
UPLOAD_TO_S3: true
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_BASEURL: ${{ secrets.AWS_BASEURL }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_BUCKET: ${{ secrets.AWS_BUCKET }}