This repository has been archived by the owner on Mar 28, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 114
455 lines (445 loc) · 18.5 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
450
451
452
453
454
455
name: Release
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
workflow_dispatch:
jobs:
macos:
runs-on: macos-latest
env:
PKG_CONFIG_PATH: /usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
steps:
- uses: actions/checkout@v2
- name: Install macfuse
run: |
brew install macfuse
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: aarch64-apple-darwin
profile: minimal
default: true
- name: Cache cargo build
uses: Swatinem/rust-cache@v1
- name: Build wheels - x86_64
uses: messense/maturin-action@v1
with:
target: x86_64-apple-darwin
args: --release --out dist --strip
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist
if-no-files-found: error
- name: Upload binary artifacts
uses: actions/upload-artifact@v2
with:
name: apple-darwin-bin
path: target/x86_64-apple-darwin/release/aliyundrive-fuse
if-no-files-found: error
- name: Get tag
if: "startsWith(github.ref, 'refs/tags/')"
id: tag
uses: dawidd6/action-get-tag@v1
- name: Archive binary
if: "startsWith(github.ref, 'refs/tags/')"
run: |
cd target/x86_64-apple-darwin/release
tar czvf aliyundrive-fuse-${{ steps.tag.outputs.tag }}.apple-darwin.tar.gz aliyundrive-fuse
shasum -a 256 aliyundrive-fuse-${{ steps.tag.outputs.tag }}.apple-darwin.tar.gz > aliyundrive-fuse-${{ steps.tag.outputs.tag }}.apple-darwin.tar.gz.sha256
cd -
- name: Upload binary to GitHub Release
uses: svenstaro/upload-release-action@v2
if: "startsWith(github.ref, 'refs/tags/')"
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/x86_64-apple-darwin/release/aliyundrive-fuse*.tar.gz
file_glob: true
overwrite: true
tag: ${{ github.ref }}
linux:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [
{ target: "x86_64-unknown-linux-musl", image_tag: "x86_64-musl", wheel: true, deb: true },
{ target: "i686-unknown-linux-musl", image_tag: "i686-musl", wheel: true, deb: true },
{ target: "aarch64-unknown-linux-musl", image_tag: "aarch64-musl", wheel: true, deb: true },
{ target: "armv7-unknown-linux-musleabihf", image_tag: "armv7-musleabihf", wheel: true, deb: true },
{ target: "armv7-unknown-linux-musleabi", image_tag: "armv7-musleabi", wheel: false, deb: true },
{ target: "arm-unknown-linux-musleabihf", image_tag: "arm-musleabihf", wheel: false, deb: false },
{ target: "arm-unknown-linux-musleabi", image_tag: "arm-musleabi", wheel: false, deb: false },
]
container:
image: docker://messense/rust-musl-cross:${{ matrix.platform.image_tag }}
env:
CFLAGS_armv7_unknown_linux_musleabihf: '-mfpu=vfpv3-d16'
steps:
- uses: actions/checkout@v2
- name: Cache cargo build
uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.platform.target }}
- name: Build wheels - manylinux
uses: messense/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
manylinux: auto
container: off
args: --release -o dist --strip --no-default-features --features rustls-tls
- name: Build wheels - musllinux
if: matrix.platform.wheel
uses: messense/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
manylinux: musllinux_1_1
container: off
args: --release -o dist --strip --no-default-features --features rustls-tls
- name: Install cargo packages
if: matrix.platform.deb
run: |
which cargo-deb > /dev/null || cargo install --target `rustc -vV | grep host: | awk '{print $2}'` cargo-deb
which cargo-generate-rpm > /dev/null || cargo install --target `rustc -vV | grep host: | awk '{print $2}'` cargo-generate-rpm
- name: Build Debian package
if: matrix.platform.deb
run: cargo deb --target=${{ matrix.platform.target }} --no-build --no-strip
- name: Build RPM package
if: matrix.platform.deb
run: cargo generate-rpm --target=${{ matrix.platform.target }} --payload-compress none
- name: Upload wheels
if: matrix.platform.wheel
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist
if-no-files-found: error
- name: Upx compress binary
uses: crazy-max/ghaction-upx@v1
with:
version: latest
files: target/${{ matrix.platform.target }}/release/aliyundrive-fuse
- name: Upload binary artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.platform.target }}-bin
path: target/${{ matrix.platform.target }}/release/aliyundrive-fuse
if-no-files-found: error
- name: Upload deb artifacts
if: matrix.platform.deb
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.platform.target }}-deb
path: target/${{ matrix.platform.target }}/debian/aliyundrive-fuse_*.deb
if-no-files-found: error
- name: Upload RPM artifacts
if: matrix.platform.deb
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.platform.target }}-rpm
path: target/${{ matrix.platform.target }}/generate-rpm/aliyundrive-fuse*.rpm
if-no-files-found: error
- name: Get tag
if: "startsWith(github.ref, 'refs/tags/')"
id: tag
uses: dawidd6/action-get-tag@v1
- name: Archive binary
if: "startsWith(github.ref, 'refs/tags/')"
run: |
cd target/${{ matrix.platform.target }}/release
tar czvf aliyundrive-fuse-${{ steps.tag.outputs.tag }}.${{ matrix.platform.target }}.tar.gz aliyundrive-fuse
shasum -a 256 aliyundrive-fuse-${{ steps.tag.outputs.tag }}.${{ matrix.platform.target }}.tar.gz > aliyundrive-fuse-${{ steps.tag.outputs.tag }}.${{ matrix.platform.target }}.tar.gz.sha256
cd -
- name: Upload binary to GitHub Release
uses: svenstaro/upload-release-action@v2
if: "startsWith(github.ref, 'refs/tags/')"
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.platform.target }}/release/aliyundrive-fuse*.tar.gz*
file_glob: true
overwrite: true
tag: ${{ github.ref }}
- name: Upload deb to GitHub Release
uses: svenstaro/upload-release-action@v2
if: "startsWith(github.ref, 'refs/tags/') && matrix.platform.deb"
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.platform.target }}/debian/aliyundrive-fuse_*.deb
file_glob: true
overwrite: true
tag: ${{ github.ref }}
- name: Upload RPM to GitHub Release
uses: svenstaro/upload-release-action@v2
if: "startsWith(github.ref, 'refs/tags/') && matrix.platform.deb"
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.platform.target }}/generate-rpm/aliyundrive-fuse*.rpm
file_glob: true
overwrite: true
tag: ${{ github.ref }}
- name: Remove cached deb and RPM packages
if: matrix.platform.deb
run: |
rm -rf target/${{ matrix.platform.target }}/debian
rm -rf target/${{ matrix.platform.target }}/generate-rpm
linux-others:
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- target: "armv5te-unknown-linux-musleabi"
image_tag: "armv5te-musleabi"
cargo_extra_args: --no-default-features --features rustls-tls
- target: "mips-unknown-linux-musl"
image_tag: "mips-musl"
cargo_extra_args: --no-default-features --features native-tls-vendored
- target: "mipsel-unknown-linux-musl"
image_tag: "mipsel-musl"
cargo_extra_args: --no-default-features --features native-tls-vendored
container:
image: docker://messense/rust-musl-cross:${{ matrix.platform.image_tag }}
steps:
- uses: actions/checkout@v2
- name: Cache cargo build
uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.platform.target }}
- name: Build
env:
RUSTFLAGS: -C target-feature=+crt-static -C link-arg=-s
run: |
cargo build --release --target ${{ matrix.platform.target }} ${{ matrix.platform.cargo_extra_args }}
- name: Upx compress binary
uses: crazy-max/ghaction-upx@v1
with:
version: v3.95 # v3.96 breaks mipsel, https://github.com/upx/upx/issues/504
files: target/${{ matrix.platform.target }}/release/aliyundrive-fuse
- name: Upload binary artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.platform.target }}-bin
path: target/${{ matrix.platform.target }}/release/aliyundrive-fuse
if-no-files-found: error
- name: Get tag
if: "startsWith(github.ref, 'refs/tags/')"
id: tag
uses: dawidd6/action-get-tag@v1
- name: Archive binary
if: "startsWith(github.ref, 'refs/tags/')"
run: |
cd target/${{ matrix.platform.target }}/release
tar czvf aliyundrive-fuse-${{ steps.tag.outputs.tag }}.${{ matrix.platform.target }}.tar.gz aliyundrive-fuse
shasum -a 256 aliyundrive-fuse-${{ steps.tag.outputs.tag }}.${{ matrix.platform.target }}.tar.gz > aliyundrive-fuse-${{ steps.tag.outputs.tag }}.${{ matrix.platform.target }}.tar.gz.sha256
cd -
- name: Upload binary to GitHub Release
uses: svenstaro/upload-release-action@v2
if: "startsWith(github.ref, 'refs/tags/')"
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.platform.target }}/release/aliyundrive-fuse*.tar.gz*
file_glob: true
overwrite: true
tag: ${{ github.ref }}
openwrt:
name: OpenWrt Package - ${{ matrix.target.arch }}
runs-on: ubuntu-latest
needs: [ linux, linux-others ]
environment: OpenWrt
strategy:
matrix:
target:
- arch: "aarch64_generic"
sdk: "https://downloads.openwrt.org/snapshots/targets/rockchip/armv8/openwrt-sdk-rockchip-armv8_gcc-11.3.0_musl.Linux-x86_64.tar.xz"
- arch: "arm_cortex-a9"
sdk: "https://downloads.openwrt.org/snapshots/targets/bcm53xx/generic/openwrt-sdk-bcm53xx-generic_gcc-11.3.0_musl_eabi.Linux-x86_64.tar.xz"
- arch: "aarch64_cortex-a53"
sdk: "https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2710/openwrt-sdk-bcm27xx-bcm2710_gcc-11.3.0_musl.Linux-x86_64.tar.xz"
- arch: "aarch64_cortex-a72"
sdk: "https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2711/openwrt-sdk-bcm27xx-bcm2711_gcc-11.3.0_musl.Linux-x86_64.tar.xz"
- arch: "x86_64"
sdk: "https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-sdk-x86-64_gcc-11.3.0_musl.Linux-x86_64.tar.xz"
- arch: "i386_pentium4"
sdk: "https://downloads.openwrt.org/snapshots/targets/x86/generic/openwrt-sdk-x86-generic_gcc-11.3.0_musl.Linux-x86_64.tar.xz"
- arch: "arm_mpcore"
sdk: "https://downloads.openwrt.org/snapshots/targets/oxnas/ox820/openwrt-sdk-oxnas-ox820_gcc-11.3.0_musl_eabi.Linux-x86_64.tar.xz"
- arch: "arm_cortex-a5_vfpv4"
sdk: "https://downloads.openwrt.org/snapshots/targets/at91/sama5/openwrt-sdk-at91-sama5_gcc-11.3.0_musl_eabi.Linux-x86_64.tar.xz"
- arch: "arm_cortex-a7_neon-vfpv4"
sdk: "https://downloads.openwrt.org/snapshots/targets/ipq40xx/generic/openwrt-sdk-ipq40xx-generic_gcc-11.3.0_musl_eabi.Linux-x86_64.tar.xz"
- arch: "mipsel_24kc"
sdk: "https://downloads.openwrt.org/snapshots/targets/ramips/mt7621/openwrt-sdk-ramips-mt7621_gcc-11.3.0_musl.Linux-x86_64.tar.xz"
- arch: "mips_24kc"
sdk: "https://archive.openwrt.org/releases/19.07.7/targets/ar71xx/nand/openwrt-sdk-19.07.7-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64.tar.xz"
steps:
- uses: actions/checkout@v2
- name: Install build requirements
run: |
sudo apt-get update
sudo apt-get install -y build-essential ccache ecj fastjar file g++ gawk \
gettext git java-propose-classpath libelf-dev libncurses5-dev \
libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget \
python3-distutils python3-setuptools python3-dev rsync subversion \
swig time xsltproc zlib1g-dev
- name: Install OpenWrt SDK
run: |
wget -O openwrt-sdk.tar.xz ${{ matrix.target.sdk }}
xz -q -d openwrt-sdk.tar.xz && tar -xvf openwrt-sdk.tar
mv -f openwrt-sdk-* openwrt-sdk
- name: Build Package
run: |
echo "src-link aliyundrive $GITHUB_WORKSPACE/openwrt" > openwrt-sdk/feeds.conf
echo 'CONFIG_PACKAGE_aliyundrive-fuse=y
CONFIG_PACKAGE_luci-app-aliyundrive-fuse=y
' >> openwrt-sdk/.config
cd openwrt-sdk
cat feeds.conf.default >> feeds.conf
cat feeds.conf
./scripts/feeds update -a > /dev/null
make defconfig
./scripts/feeds install -d y -f -a
make package/aliyundrive-fuse/compile V=s
make package/luci-app-aliyundrive-fuse/compile V=s
tree bin/packages/
- name: Archive package
uses: actions/upload-artifact@v2
with:
name: aliyundrive-fuse-openwrt-${{ matrix.target.arch }}
path: openwrt-sdk/bin/packages/*/aliyundrive/aliyundrive-fuse*.ipk
if-no-files-found: error
- name: Archive luci packages
uses: actions/upload-artifact@v2
if: ${{ matrix.target.arch == 'aarch64_generic' }}
with:
name: aliyundrive-fuse-openwrt-${{ matrix.target.arch }}
path: openwrt-sdk/bin/packages/*/aliyundrive/luci-*.ipk
if-no-files-found: error
- name: Upload package to GitHub Release
uses: svenstaro/upload-release-action@v2
if: "startsWith(github.ref, 'refs/tags/')"
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
overwrite: true
file: openwrt-sdk/bin/packages/*/aliyundrive/aliyundrive-fuse*.ipk
tag: ${{ github.ref }}
- name: Upload luci packages to GitHub Release
uses: svenstaro/upload-release-action@v2
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.target.arch == 'aarch64_generic' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
overwrite: true
file: openwrt-sdk/bin/packages/*/aliyundrive/luci-*.ipk
tag: ${{ github.ref }}
docker:
name: Build Docker Image
runs-on: ubuntu-latest
needs: [ linux ]
environment: Docker Hub
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: x86_64-unknown-linux-musl-bin
- run: |
chmod a+x aliyundrive-fuse
mv aliyundrive-fuse aliyundrive-fuse-amd64
- uses: actions/download-artifact@v2
with:
name: i686-unknown-linux-musl-bin
- run: |
chmod a+x aliyundrive-fuse
mv aliyundrive-fuse aliyundrive-fuse-386
- uses: actions/download-artifact@v2
with:
name: aarch64-unknown-linux-musl-bin
- run: |
chmod a+x aliyundrive-fuse
mv aliyundrive-fuse aliyundrive-fuse-arm64
- uses: actions/download-artifact@v2
with:
name: armv7-unknown-linux-musleabihf-bin
- run: |
chmod a+x aliyundrive-fuse
mv aliyundrive-fuse aliyundrive-fuse-armv7
- uses: actions/download-artifact@v2
with:
name: arm-unknown-linux-musleabihf-bin
- run: |
chmod a+x aliyundrive-fuse
mv aliyundrive-fuse aliyundrive-fuse-armv6
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
messense/aliyundrive-fuse
ghcr.io/messense/aliyundrive-fuse
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Setup QEMU
uses: dbhi/qus/action@main
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: docker build
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6
push: ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker Hub Description
if: github.event_name != 'pull_request'
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
repository: messense/aliyundrive-fuse
release:
name: Release
runs-on: ubuntu-latest
environment:
name: PyPI
url: https://pypi.org/project/aliyundrive-fuse/
if: "startsWith(github.ref, 'refs/tags/')"
needs: [ linux, macos ]
steps:
- uses: actions/download-artifact@v2
with:
name: wheels
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install --upgrade twine
twine upload --skip-existing *