Remove node-pre-gyp, use prebuildify #14
Workflow file for this run
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
name: Prebuildify, package, publish | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
release: | ||
types: [ prereleased, released ] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
platform: [linux/amd64, linux/arm64/v8, linux/arm/v7] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: docker/setup-qemu-action@v1 | ||
with: | ||
image: tonistiigi/binfmt:latest | ||
platforms: arm,arm64 | ||
- run: docker build . | ||
--tag node-bcrypt-builder | ||
--platform ${{ matrix.platform }} | ||
- run: docker create node-bcrypt-builder | ||
--platform ${{ matrix.platform }} | ||
--name node-bcryptjs-builder | ||
- run: docker cp "node-bcryptjs-builder:/usr/local/opt/bcrypt-js/prebuilds" . | ||
# build for Alpine: | ||
- run: docker build -f Dockerfile-alpine . | ||
--tag node-bcrypt-builder-alpine | ||
--platform ${{ matrix.platform }} | ||
- run: docker create node-bcrypt-builder-alpine | ||
--platform ${{ matrix.platform }} | ||
--name node-bcryptjs-builder-alpine | ||
- run: docker cp "node-bcryptjs-builder-alpine:/usr/local/opt/bcrypt-js/prebuilds" . | ||
- run: find prebuilds | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: prebuild-${{ matrix.platform }} | ||
path: ./prebuilds | ||
pack: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 20 | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: npm ci | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
path: /tmp/prebuilds/ | ||
- name: Coalesce prebuilds from build matrix | ||
run: | | ||
mkdir prebuilds | ||
for d in /tmp/prebuilds/*; do | ||
cp -Rav $d/* prebuilds/ | ||
done | ||
- run: chmod a+x prebuilds/*/*.node && find prebuilds -executable -type f | ||
- run: echo "PACK_FILE=$(npm pack)" >> $GITHUB_ENV | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: package-tgz | ||
path: ${{ env.PACK_FILE }} | ||
publish-npm: | ||
needs: pack | ||
if: github.event_name == 'release' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 20 | ||
registry-url: 'https://registry.npmjs.org' | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: package-tgz | ||
path: /tmp/package/ | ||
- run: npm publish /tmp/package/bcrypt*.tgz | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
publish-gpr: | ||
needs: pack | ||
if: github.event_name == 'release' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 20 | ||
registry-url: https://npm.pkg.github.com/ | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: package-tgz | ||
path: /tmp/package/ | ||
- run: npm publish /tmp/package/bcrypt*.tgz | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||