forked from nospaceships/node-os-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(*): use pre-built binaries (#27)
- Loading branch information
Showing
9 changed files
with
4,318 additions
and
4,318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,307 @@ | ||
name: Automated deploy | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
workflow_dispatch: | ||
release: | ||
types: [created] | ||
|
||
env: | ||
VERSION: ${{ github.event.release.tag_name }} | ||
TARGET_REF: ${{ github.event.release.target_commitish }} | ||
|
||
jobs: | ||
build_x86_64: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ ubuntu-20.04, macos-11, windows-2019 ] | ||
node: [ 14, 16, 18, 19, 20 ] | ||
arch: [ x64 ] | ||
include: | ||
- os: windows-2019 | ||
node: 16 | ||
arch: ia32 | ||
- os: windows-2019 | ||
node: 18 | ||
arch: ia32 | ||
- os: windows-2019 | ||
node: 19 | ||
arch: ia32 | ||
- os: windows-2019 | ||
node: 20 | ||
arch: ia32 | ||
exclude: | ||
- os: windows-2019 | ||
node: 14 | ||
arch: x64 | ||
env: | ||
npm_config_msvs_version: 2019 | ||
npm_config_python: python3.10 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.TARGET_REF }} | ||
token: ${{ secrets.GPR_TOKEN }} | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
architecture: ${{ matrix.arch == 'ia32' && 'x86' || 'x64' }} | ||
|
||
- name: Install dependencies | ||
run: npm ci --ignore-scripts | ||
|
||
- name: Prebuild package | ||
run: npx @mapbox/node-pre-gyp --target_arch=${{ matrix.arch }} configure build package | ||
|
||
- name: Upload binaries to GitHub Release | ||
run: npx node-pre-gyp-github publish | ||
env: | ||
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} | ||
build_musl_x86_64: | ||
runs-on: ubuntu-20.04 | ||
container: | ||
image: node:${{ matrix.node }}-alpine | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node: [ 14, 16, 18, 19, 20 ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.TARGET_REF }} | ||
token: ${{ secrets.GPR_TOKEN }} | ||
|
||
- name: Setup env with Node v${{ matrix.node }} | ||
run: | | ||
apk add --update | ||
apk add --no-cache ca-certificates git curl build-base python3 g++ make | ||
- name: Install dependencies | ||
run: npm ci --ignore-scripts | ||
|
||
- name: Prebuild package | ||
run: npx @mapbox/node-pre-gyp configure build package | ||
|
||
- name: Upload binaries to GitHub Release | ||
run: | | ||
CC=x86_64-linux-musl-gcc \ | ||
CXX=x86_64-linux-musl-g++ \ | ||
npx node-pre-gyp-github publish | ||
env: | ||
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} | ||
build_aarch64: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node: [ 14, 16, 18, 19, 20 ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.TARGET_REF }} | ||
token: ${{ secrets.GPR_TOKEN }} | ||
|
||
- name: Install cross-compilation tools | ||
run: | | ||
sudo apt-get update -yq \ | ||
&& sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -yq \ | ||
&& sudo apt-get clean \ | ||
&& sudo rm -rf /var/lib/apt/lists/* | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
||
- name: Install dependencies | ||
run: npm ci --ignore-scripts | ||
|
||
- name: Prebuild package | ||
run: | | ||
CC=aarch64-linux-gnu-gcc \ | ||
CXX=aarch64-linux-gnu-g++ \ | ||
npx @mapbox/node-pre-gyp --target_arch=arm64 configure build package | ||
- name: Upload binaries to GitHub Release | ||
run: npx node-pre-gyp-github publish | ||
env: | ||
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} | ||
build_darwin_aarch64: | ||
runs-on: macos-11 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node: [ 14, 16, 18, 19, 20 ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.TARGET_REF }} | ||
token: ${{ secrets.GPR_TOKEN }} | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
||
- name: Install dependencies | ||
run: npm ci --ignore-scripts | ||
|
||
- name: Prebuild package | ||
run: | | ||
CFLAGS="-target arm64-apple-macos11 -arch arm64" \ | ||
npx @mapbox/node-pre-gyp --target_arch=arm64 configure build package | ||
- name: Upload binaries to GitHub Release | ||
run: npx node-pre-gyp-github publish | ||
env: | ||
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} | ||
build_musl_aarch64: | ||
runs-on: ubuntu-20.04 | ||
container: | ||
image: node:${{ matrix.node }}-alpine | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node: [ 14, 16, 18, 19, 20 ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.TARGET_REF }} | ||
token: ${{ secrets.GPR_TOKEN }} | ||
|
||
- name: Setup env with Node v${{ matrix.node }} | ||
run: | | ||
apk add --update | ||
apk add --no-cache ca-certificates git curl build-base python3 g++ make | ||
- name: Setup musl cross compiler | ||
run: | | ||
curl -OL https://musl.cc/aarch64-linux-musl-cross.tgz | ||
tar -xzvf aarch64-linux-musl-cross.tgz | ||
$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc --version | ||
- name: Install dependencies | ||
run: npm ci --ignore-scripts | ||
|
||
- name: Prebuild package | ||
run: | | ||
CC=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc \ | ||
CXX=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-g++ \ | ||
npx @mapbox/node-pre-gyp --target_arch=arm64 configure build package | ||
- name: Upload binaries to GitHub Release | ||
run: npx node-pre-gyp-github publish | ||
env: | ||
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} | ||
build_arm: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node: [ 14, 16, 18, 19, 20 ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.TARGET_REF }} | ||
token: ${{ secrets.GPR_TOKEN }} | ||
|
||
- name: Install cross-compilation tools | ||
run: | | ||
sudo apt-get update -yq \ | ||
&& sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -yq \ | ||
&& sudo apt-get clean \ | ||
&& sudo rm -rf /var/lib/apt/lists/* | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
||
- name: Install dependencies | ||
run: npm ci --ignore-scripts | ||
|
||
- name: Prebuild package | ||
run: | | ||
CC=arm-linux-gnueabihf-gcc \ | ||
CXX=arm-linux-gnueabihf-g++ \ | ||
npx @mapbox/node-pre-gyp --target_arch=arm configure build package | ||
- name: Upload binaries to GitHub Release | ||
run: npx node-pre-gyp-github publish | ||
env: | ||
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} | ||
build_musl_arm: | ||
runs-on: ubuntu-20.04 | ||
container: | ||
image: node:${{ matrix.node }}-alpine | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node: [ 14, 16, 18, 19, 20 ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.TARGET_REF }} | ||
token: ${{ secrets.GPR_TOKEN }} | ||
|
||
- name: Setup env with Node v${{ matrix.node }} | ||
run: | | ||
apk add --update | ||
apk add --no-cache ca-certificates git curl build-base python3 g++ make | ||
- name: Setup musl cross compiler | ||
run: | | ||
curl -OL https://musl.cc/arm-linux-musleabihf-cross.tgz | ||
tar -xzvf arm-linux-musleabihf-cross.tgz | ||
$(pwd)/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-gcc --version | ||
- name: Install dependencies | ||
run: npm ci --ignore-scripts | ||
|
||
- name: Prebuild package | ||
run: | | ||
CC=$(pwd)/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-gcc \ | ||
CXX=$(pwd)/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-g++ \ | ||
npx @mapbox/node-pre-gyp --target_arch=arm configure build package | ||
- name: Upload binaries to GitHub Release | ||
run: npx node-pre-gyp-github publish | ||
env: | ||
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} | ||
deploy: | ||
needs: | ||
- build_x86_64 | ||
- build_musl_x86_64 | ||
- build_aarch64 | ||
- build_darwin_aarch64 | ||
- build_musl_aarch64 | ||
- build_arm | ||
- build_musl_arm | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ env.TARGET_REF }} | ||
token: ${{ secrets.GPR_TOKEN }} | ||
|
||
- uses: actions/setup-node@v1 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 12 | ||
node-version: 18 | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- run: echo "VERSION=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV | ||
|
||
- run: npm ci -q | ||
- run: npm version --no-git-tag-version "$VERSION" | ||
- name: Install dependencies | ||
run: npm ci --ignore-scripts | ||
|
||
- run: npm publish | ||
- name: Publish to npm | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- uses: actions/setup-node@v1 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 12 | ||
node-version: 18 | ||
registry-url: 'https://npm.pkg.github.com' | ||
scope: '@NeuraLegion' | ||
|
||
- run: npm publish | ||
- name: Publish to GPR | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GPR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
syntax: glob | ||
.idea | ||
build | ||
lib | ||
node_modules/ | ||
example/*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.github | ||
build | ||
lib | ||
node_modules | ||
.releaserc | ||
.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.