Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Publish Node Addon

Publish Node Addon #12

Workflow file for this run

name: Publish Node Addon
on:
workflow_dispatch:
# Enables manual triggering via GitHub Actions
push:
tags:
- 'v*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-xlarge]
steps:
- name: Check out the code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
registry-url: 'https://npm.pkg.github.com'
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install dependencies
run: npm install
- name: Build package
run: node -e "console.log(process.arch)" && npm run build-release
- name: Run test
run: npm start
- name: Rename and move binary
run: |
mkdir -p ./binaries
mv index.node ./binaries/index-${{ matrix.os }}.node
- name: Upload binary artifact
uses: actions/upload-artifact@v2
with:
name: binary-${{ matrix.os }}
path: ./binaries/index-${{ matrix.os }}.node
# publish:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Set up Node.js
# uses: actions/setup-node@v2
# with:
# node-version: '18'
# registry-url: 'https://npm.pkg.github.com/'
# scope: '@robocorp'
# - name: Download all artifacts
# uses: actions/download-artifact@v2
# with:
# path: ./artifacts
# - name: Prepare package
# run: |
# mkdir -p ./binaries
# mv ./artifacts/binary-ubuntu-latest/index-ubuntu-latest.node ./binaries/
# mv ./artifacts/binary-windows-latest/index-windows-latest.node ./binaries/
# mv ./artifacts/binary-macos-latest/index-macos-latest.node ./binaries/
# - name: Publish to GitHub Packages
# run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}