-
Notifications
You must be signed in to change notification settings - Fork 42
86 lines (76 loc) · 2.39 KB
/
nodejs.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
name: Build and publish Node.js package
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
target:
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-gnu
- aarch64-apple-darwin
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
include:
- target: aarch64-unknown-linux-gnu
os: ubuntu-20.04
- target: x86_64-unknown-linux-gnu
os: ubuntu-20.04
- target: aarch64-apple-darwin
os: macos-11.0
- target: x86_64-apple-darwin
os: macos-11.0
- target: x86_64-pc-windows-msvc
os: windows-2019
steps:
- uses: actions/checkout@v1
- name: Set up Node.js
uses: actions/setup-node@master
with:
node-version: 17.x
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Set up cross compiler
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
working-directory: ./minify-html-nodejs
run: |
sudo apt install -y gcc-aarch64-linux-gnu
- name: Build native module
working-directory: ./minify-html-nodejs
shell: bash
run: |
npm install
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc
npm run build-release -- --target ${{ matrix.target }}
mv -v index.node plat-pkg/.
TARGET=${{ matrix.target }} node plat-pkg/package.json.gen.js
- name: Create and publish native package
uses: JS-DevTools/npm-publish@v3
if: startsWith(github.ref, 'refs/tags/v')
with:
access: public
token: ${{ secrets.NPM_AUTH_TOKEN }}
package: ./minify-html-nodejs/plat-pkg
package:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v1
- name: Prepare package
working-directory: ./minify-html-nodejs
run: |
# npm refuses to work with symlinks.
cp ../README.md .
- name: Pack and publish package
uses: JS-DevTools/npm-publish@v3
if: startsWith(github.ref, 'refs/tags/v')
with:
access: public
token: ${{ secrets.NPM_AUTH_TOKEN }}
package: ./minify-html-nodejs