Node.js Package #57
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 workflow will run tests using node and then publish a package to GitHub Packages when a release is created | |
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | |
name: Node.js Package | |
on: | |
# release: | |
# types: [created] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
deployments: write | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
registry-url: https://npm.pkg.github.com/ | |
- uses: mmomtchev/setup-swig@v3 | |
with: | |
branch: jse | |
- run: swig -version | |
# build x86_64 version, test, pack, package and native module | |
- run: npm i --ignore-scripts | |
- run: ./node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp rebuild package | |
- run: npm run test | |
- run: npm publish | |
- run: NODE_PRE_GYP_GITHUB_TOKEN=$NODE_AUTH_TOKEN node ./node_modules/node-pre-gyp-github/bin/node-pre-gyp-github.js publish --release | |
# build for mac, package and upload native module | |
- run: sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
- run: curl -s https://nodejs.org/download/release/$(node --version)/node-$(node --version)-linux-arm64.tar.gz > /tmp/nodearm64.tgz | |
- run: npm i --ignore-scripts | |
- run: CCARCH=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ CC_host="gcc" CXX_host="g++" ./node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp rebuild package --tarball /tmp/nodearm64.tgz --arch=arm64 | |
- run: NODE_PRE_GYP_GITHUB_TOKEN=$NODE_AUTH_TOKEN node ./node_modules/node-pre-gyp-github/bin/node-pre-gyp-github.js publish --release --arch=arm64 | |
# publish-gpr: | |
# needs: build | |
# runs-on: ubuntu-latest | |
# permissions: | |
# contents: read | |
# packages: write | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - uses: actions/setup-node@v3 | |
# with: | |
# node-version: 20 | |
# registry-url: https://npm.pkg.github.com/ | |
# - run: npm ci | |
# - run: npm publish | |
# env: | |
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |