I recently have released an npm module, that is a C++ addon, using prebuild to compile binaries. Here my CI (I use github actions):
name: CI
on:
push:
branches: [master]
jobs:
release:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.AT }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v1
with:
node-version: "14"
- run: |
git config user.email "matteo.di.sabatino.1989@gmail.com"
git config user.name "Matteo Di Sabatino"
npm i
npm test
npm run release
build-linux:
needs: release
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.AT }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v1
with:
node-version: "14"
- run: |
git pull
npm i
npm run prebuild -- -u $GITHUB_TOKEN
build-macos:
needs: release
runs-on: macos-latest
env:
GITHUB_TOKEN: ${{ secrets.AT }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v1
with:
node-version: "14"
- run: |
git pull
npm i
npm run prebuild -- -u $GITHUB_TOKEN
build-windows:
needs: release
runs-on: windows-latest
env:
GITHUB_TOKEN: ${{ secrets.AT }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v1
with:
node-version: "14"
- run: |
git pull
npm i
npm run prebuild -- -u %GITHUB_TOKEN%
publish:
needs: [build-linux, build-macos, build-windows]
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v1
with:
node-version: "14"
- run: |
git pull
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
npm publish --access=public
As you can read, first I use the module release-it in order to update the changelog, create the tag and the release, but not publish to npm. Then I build the source for Linux, macOS and Windows and, finally, I publish the module to npm.
I supposed all worked fine since the binaries have been attached to the release (see here) but I was wrong in fact, if I try to install my module via npm i @matteodisabatino/gc_info, I receive this warning prebuild-install WARN install No prebuilt binaries found (target=14.15.5 runtime=node arch=x64 libc=musl platform=linux).
I suppose this mean that the binaries are attached to the release but npm was not able to find them. What am I wronging?
P.S.: the command npm run prebuild runs prebuild --target 64 --target 72 --target 83 --target 88 --force --strip --tag-prefix \"\" since I decided to compile for Node.js 10, 12, 14 and 15 only.
I recently have released an npm module, that is a C++ addon, using prebuild to compile binaries. Here my CI (I use github actions):
As you can read, first I use the module release-it in order to update the changelog, create the tag and the release, but not publish to npm. Then I build the source for Linux, macOS and Windows and, finally, I publish the module to npm.
I supposed all worked fine since the binaries have been attached to the release (see here) but I was wrong in fact, if I try to install my module via
npm i @matteodisabatino/gc_info, I receive this warningprebuild-install WARN install No prebuilt binaries found (target=14.15.5 runtime=node arch=x64 libc=musl platform=linux).I suppose this mean that the binaries are attached to the release but npm was not able to find them. What am I wronging?
P.S.: the command
npm run prebuildrunsprebuild --target 64 --target 72 --target 83 --target 88 --force --strip --tag-prefix \"\"since I decided to compile for Node.js 10, 12, 14 and 15 only.