Skip to content

Publish

Publish #2

Workflow file for this run

name: Publish
on:
release:
types: [published]
jobs:
build:
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
- host: macos-latest
target: aarch64-apple-darwin
- host: linux-ubuntu-latest
target: x86_64-unknown-linux-gnu
- host: linux-ubuntu-latest
target: aarch64-unknown-linux-gnu
- host: windows-server-latest
target: x86_64-pc-windows-msvc
name: Build - ${{ matrix.settings.target }}
runs-on:
group: databricks-protected-runner-group
labels: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Install Rust (Unix)
if: runner.os != 'Windows'
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install Rust (Windows)
if: runner.os == 'Windows'
run: |
Invoke-WebRequest -Uri https://win.rustup.rs/x86_64 -OutFile rustup-init.exe
.\rustup-init.exe -y --default-toolchain stable
echo "$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: powershell
- name: Add Rust target
run: rustup target add ${{ matrix.settings.target }}
- name: Install cross-compilation tools (Linux ARM64)
if: matrix.settings.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build -- --target ${{ matrix.settings.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: '*.node'
if-no-files-found: error
publish:
name: Publish to NPM
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move artifacts
run: npm run artifacts
- name: List packages
run: ls -R ./npm
- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}