-
Notifications
You must be signed in to change notification settings - Fork 43
449 lines (399 loc) · 13.7 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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Build Packages
on:
release:
types: [published]
push:
tags:
- v*
branches: [ master, dev]
pull_request:
branches: [ master ]
# # Allows you to run this workflow manually from the Actions tab
# workflow_dispatch:
jobs:
build-src:
name: Build Base Packages
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
ARCH: ['x86_64']
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
- name: Prepare
run: |
sudo apt install wget exiftool
sudo npm install asar -g
echo "$UID, $GID"
- name: Generate TAG
id: Tag
run: |
tag='continuous'
name='Continuous Build'
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
tag='${{ github.ref_name }}'
name='${{ github.ref_name }}'
fi
echo "tag result: $tag - $name"
echo "::set-output name=tag::$tag"
echo "::set-output name=name::$name"
- name: Build
run: |
ls -l
tools/setup-bilibili
- name: Compress Resources
run: |
ls -l
mkdir -p tmp/src
mkdir -p tmp/build
tar -zcf tmp/src/bilibili-${{ steps.tag.outputs.tag }}-${{ matrix.ARCH }}.tar.gz bin app electron
tar -zcf tmp/build/extensions-${{ steps.tag.outputs.tag }}.tar.gz extensions
- name: Upload artifact
uses: actions/upload-artifact@v2.3.1
with:
# Artifact name
name: bilibili-${{ matrix.ARCH }}.src
path: tmp/src
- name: Upload artifact
uses: actions/upload-artifact@v2.3.1
with:
# Artifact name
name: bilibili-${{ matrix.ARCH }}.build
path: tmp/build
build-linux:
name: Build Linux
needs:
- build-src
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
ARCH: ['x86_64']
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Prepare
run: |
sudo npm install asar -g
npm install
echo "$UID, $GID"
- name: Generate TAG
id: Tag
run: |
tag='continuous'
name='Continuous Build'
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
tag='${{ github.ref_name }}'
name='${{ github.ref_name }}'
fi
echo "tag result: $tag - $name"
echo "::set-output name=tag::$tag"
echo "::set-output name=name::$name"
- name: Build
env:
BUILD_VERSION: ${{ steps.tag.outputs.tag }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ls -l
mkdir -p tmp/build
tools/build-prepare.sh
asar e app/app.asar app/app
npm run pkg-linux
rm -rf tmp/build/linux-unpacked
# tools/build-appimage.sh ${{ steps.tag.outputs.tag }} ${{ matrix.ARCH }}
- name: Upload artifact
uses: actions/upload-artifact@v2.3.1
with:
# Artifact name
name: bilibili-${{ matrix.ARCH }}.build
path: tmp/build
build-win:
name: Build Windows
needs:
- build-src
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [16.x]
ARCH: ['x86_64']
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Prepare
run: |
set -x -u -o pipefail
source /etc/os-release
# Get rid of packages installed from ppa:ondrej/php so that we will be able to install wine32:i386 without conflicts
# (see issue https://github.com/actions/virtual-environments/issues/4589)
# In detail we:
# 1. Remove all packages that ppa:ondrej/php has but plain Ubuntu doesn't, e.g. everything PHP
# 2. Revert (remaining) packages that ppa:ondrej/php and plain Ubuntu share, back to the plain Ubuntu version
# 3. Assert that no packages from ppa:ondrej/php are left installed
dpkg -l | grep '^ii' | grep -F deb.sury.org | awk '{print $2}' | grep '^php' \
| xargs -r -t sudo apt-get remove --yes libpcre2-posix3 libzip4
dpkg -l | grep '^ii' | grep -F deb.sury.org | awk '{print $2}' | sed "s,\$,/${UBUNTU_CODENAME}," \
| xargs -r -t sudo apt-get install --yes --no-install-recommends --allow-downgrades -V
! dpkg -l | grep '^ii' | grep -F deb.sury.org
sudo apt update
sudo apt install -y wine64
sudo dpkg --add-architecture i386
dpkg --print-foreign-architectures
sudo apt update
sudo apt install libwine
echo "install wine32..."
sudo apt install wine32
sudo npm install asar -g
npm install
echo "$UID"
- name: Generate TAG
id: Tag
run: |
tag='continuous'
name='Continuous Build'
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
tag='${{ github.ref_name }}'
name='${{ github.ref_name }}'
fi
echo "tag result: $tag - $name"
echo "::set-output name=tag::$tag"
echo "::set-output name=name::$name"
- name: Build
env:
BUILD_VERSION: ${{ steps.tag.outputs.tag }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ls -l
mkdir -p tmp/build
tools/build-prepare.sh
asar e app/app.asar app/app
npm run pkg-win
rm -rf tmp/build/win-unpacked
# tools/build-appimage.sh ${{ steps.tag.outputs.tag }} ${{ matrix.ARCH }}
- name: Upload artifact
uses: actions/upload-artifact@v2.3.1
with:
# Artifact name
name: bilibili-${{ matrix.ARCH }}.build
path: tmp/build
build-deepin:
name: Build Deepin Package
needs:
- build-src
runs-on: ubuntu-20.04
strategy:
matrix:
ARCH: ['x86_64', 'ARM64']
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Prepare
run: |
sudo apt-get install -y build-essential fakeroot devscripts debhelper # debmake lintian pbuilder
- name: Generate TAG
id: Tag
run: |
tag='continuous'
name='Continuous Build'
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
tag='${{ github.ref_name }}'
name='${{ github.ref_name }}'
else
BILIBILI_VERSION=$(cat conf/bilibili_version)
tag="v${BILIBILI_VERSION}-${tag}"
fi
echo "tag result: $tag - $name"
echo "::set-output name=tag::$tag"
echo "::set-output name=name::$name"
# https://stackoverflow.com/questions/61096521/how-to-use-gpg-key-in-github-actions
- name: Build Deb Package
run: |
export BUILD_VERSION=${{ steps.tag.outputs.tag }}
ls -l
mkdir -p tmp/build
tools/build-prepare.sh
echo "${{ matrix.ARCH }}"
if [ "${{ matrix.ARCH }}" == "ARM64" ];then
export BUILD_ARCH="arm64"
export LD_LIBRARY_PATH="/usr/aarch64-linux-gnu/lib"
tools/update-electron
else
export BUILD_ARCH="amd64"
fi
tools/build-deepin.sh ${{ steps.tag.outputs.tag }}
- name: Upload artifact
uses: actions/upload-artifact@v2.3.1
with:
# Artifact name
name: bilibili-${{ matrix.ARCH }}.build
path: tmp/build
# build-arch:
# name: Build ArchLinux Package
# runs-on: ubuntu-latest
# timeout-minutes: 30
# strategy:
# matrix:
# node-version: [16.x]
# ARCH: ['x86_64']
# # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: 'recursive'
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v2
# with:
# node-version: ${{ matrix.node-version }}
# cache: 'npm'
# - name: Prepare
# run: |
# cd compiler && npm install
# npm install node-gyp nw-gyp npm -g
# node-gyp install
# cat /etc/passwd
# - name: Generate TAG
# id: Tag
# run: |
# tag='continuous'
# name='Continuous Build'
# if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
# tag='${{ github.ref_name }}'
# name='${{ github.ref_name }}'
# fi
# echo "tag result: $tag - $name"
# echo "::set-output name=tag::$tag"
# echo "::set-output name=name::$name"
# - name: Build ArchLinux Package
# uses: countstarlight/arch-makepkg-action@master
# env:
# BUILD_VERSION: ${{ steps.tag.outputs.tag }}
# with:
# repos: >
# archlinuxcn=https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
# before: "tools/build-aur.sh && sudo pacman -S --noconfirm archlinuxcn-keyring"
# packages: >
# gconf
# p7zip
# libxkbfile
# python2
# openssl
# gcc
# make
# libssh2
# krb5
# wget
# scripts: "cd tmp/AUR && makepkg && ls -l && cd ../../"
# - name: Fix Permissions
# run: |
# sudo chmod -R 0777 tmp
# mkdir -p tmp/build
# mv tmp/AUR/*.pkg.* tmp/build
# cd tmp/build
# for file in `ls *.pkg.*`;do mv $file `echo $file|sed 's/:/-/g'`;done;
# ls -l
# - name: Upload artifact
# uses: actions/upload-artifact@v2.3.1
# with:
# # Artifact name
# name: bilibili-${{ matrix.ARCH }}.build
# path: tmp/build
# build-snap:
# name: Build Snap Package
# runs-on: ubuntu-18.04
# timeout-minutes: 30
# strategy:
# matrix:
# node-version: [16.x]
# ARCH: ['x86_64']
# # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: 'recursive'
# - name: Install Snapcraft
# uses: samuelmeuli/action-snapcraft@v1
# with:
# use_lxd: true
# - name: Prepare
# run: |
# cd compiler && npm install
# git --version
# git --help
# # You can now run Snapcraft shell commands
# - name: Build snap
# run: sg lxd -c 'snapcraft --use-lxd'
# - name: move file
# run: |
# mkdir -p tmp/build
# mv *.snap tmp/build
# - name: Upload artifact
# uses: actions/upload-artifact@v2.3.1
# with:
# # Artifact name
# name: bilibili-${{ matrix.ARCH }}.build
# path: tmp/build
upload:
name: Create release and upload artifacts
needs:
- build-src
- build-linux
- build-win
- build-deepin
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Inspect directory after downloading artifacts
run: ls -alFR
- name: Generate TAG
id: Tag
run: |
tag='continuous'
name='Continuous Build'
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
tag='${{ github.ref_name }}'
name='${{ github.ref_name }}'
fi
echo "tag result: $tag - $name"
echo "::set-output name=tag::$tag"
echo "::set-output name=name::$name"
- name: Create release and upload artifacts
if: startsWith(github.ref, 'refs/heads/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sudo apt install -y fuse
wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage
chmod +x pyuploadtool-x86_64.AppImage
./pyuploadtool-x86_64.AppImage \
**src/*.tar.gz \
**build/*.tar.gz \
**build/*.AppImage \
**build/*.deb \
**build/*.exe \
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
# note you'll typically need to create a personal access token
# with permissions to create releases in the other repo
name: ${{ steps.tag.outputs.name }}
tag_name: ${{ steps.tag.outputs.tag }}
files: |
**src/*.tar.gz
**build/*.tar.gz
**build/*.AppImage
**build/*.deb
**build/*.exe