Skip to content

Publish tdl

Publish tdl #47

Workflow file for this run

name: Publish tdl
# This workflow can be executed using a command like this:
# gh workflow run publish-tdl.yml --ref develop -f npm-tag=latest
on:
workflow_dispatch:
inputs:
npm-tag:
description: 'npm tag (e.g. latest, beta), required to publish'
type: string
required: false
jobs:
build-and-test:
name: Build the node addon on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- uses: goto-bus-stop/setup-zig@v2
- name: Install dependencies
run: npm install
- name: Clean old binaries
run: npm run clean -w tdl
- name: Prebuildify (Linux via zig)
if: runner.os == 'Linux'
run: |
CC="zig cc -target x86_64-linux-gnu.2.17" CXX="zig c++ -target x86_64-linux-gnu.2.17" \
npm run make-prebuild -w tdl -- --arch x64 --tag-libc
CC="zig cc -target aarch64-linux-gnu.2.17" CXX="zig c++ -target aarch64-linux-gnu.2.17" \
npm run make-prebuild -w tdl -- --arch arm64 --armv 8 --tag-armv --tag-libc
ldd packages/tdl/prebuilds/*/*.node
du -hsc packages/tdl/prebuilds/*/*.node
- name: Prebuildify
if: runner.os != 'Linux'
run: npm run make-prebuild -w tdl -- --arch x64
- name: "Prebuildify: Crosscompile to arm64 Apple Silicon"
if: runner.os == 'macOS'
run: |
npm run make-prebuild -w tdl -- --arch arm64
file packages/tdl/prebuilds/*/*.node
du -hsc packages/tdl/prebuilds/*/*.node
- name: Run tests (unit tests + integration tests)
run: npm run test:all
- uses: actions/upload-artifact@v3
with:
name: tdl-prebuilds
path: packages/tdl/prebuilds
publish:
name: 'Publish to npm'
needs: [build-and-test]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
# registry-url is mandatory here
registry-url: 'https://registry.npmjs.org'
- name: Python dependencies
run: python3 -m pip install packaging
- name: Install dependencies
run: npm install
- uses: actions/download-artifact@v3
with:
name: tdl-prebuilds
path: packages/tdl/prebuilds
- run: tree packages/tdl/prebuilds
- name: Ensure prebuilts exist
run: (( $(ls packages/tdl/prebuilds | wc -l) > 3 ))
- name: Tests (excluding integration tests)
run: npm test
- name: Publish
if: "${{ inputs.npm-tag != '' }}"
run: npm publish --provenance --access public --tag ${{ inputs.npm-tag }} -w tdl
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}