name: NPM Publish on: release: types: [ published ] jobs: node: runs-on: ubuntu-latest # Only runs on tags that matches the make-release action if: startsWith(github.ref, 'refs/tags/v') defaults: run: shell: bash working-directory: node steps: - name: Checkout uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: 20 cache: 'npm' cache-dependency-path: node/package-lock.json - name: Install dependencies run: | sudo apt update sudo apt install -y protobuf-compiler libssl-dev - name: Build run: | npm ci npm run tsc npm pack - name: Upload Linux Artifacts uses: actions/upload-artifact@v3 with: name: node-package path: | node/vectordb-*.tgz node-macos: runs-on: macos-13 # Only runs on tags that matches the make-release action if: startsWith(github.ref, 'refs/tags/v') strategy: fail-fast: false matrix: target: [x86_64-apple-darwin, aarch64-apple-darwin] steps: - name: Checkout uses: actions/checkout@v3 - name: Install system dependencies run: brew install protobuf - name: Install npm dependencies run: | cd node npm ci - name: Install rustup target if: ${{ matrix.target == 'aarch64-apple-darwin' }} run: rustup target add aarch64-apple-darwin - name: Build MacOS native node modules run: bash ci/build_macos_artifacts.sh ${{ matrix.target }} - name: Upload Darwin Artifacts uses: actions/upload-artifact@v3 with: name: native-darwin path: | node/dist/lancedb-vectordb-darwin*.tgz node-linux: name: node-linux (${{ matrix.config.arch}}-unknown-linux-gnu runs-on: ${{ matrix.config.runner }} # Only runs on tags that matches the make-release action if: startsWith(github.ref, 'refs/tags/v') strategy: fail-fast: false matrix: config: - arch: x86_64 runner: ubuntu-latest - arch: aarch64 runner: buildjet-4vcpu-ubuntu-2204-arm steps: - name: Checkout uses: actions/checkout@v3 - name: Build Linux Artifacts run: | bash ci/build_linux_artifacts.sh ${{ matrix.config.arch }} - name: Upload Linux Artifacts uses: actions/upload-artifact@v3 with: name: native-linux path: | node/dist/lancedb-vectordb-linux*.tgz node-windows: runs-on: windows-2022 # Only runs on tags that matches the make-release action if: startsWith(github.ref, 'refs/tags/v') strategy: fail-fast: false matrix: target: [x86_64-pc-windows-msvc] steps: - name: Checkout uses: actions/checkout@v3 - name: Install Protoc v21.12 working-directory: C:\ run: | New-Item -Path 'C:\protoc' -ItemType Directory Set-Location C:\protoc Invoke-WebRequest https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-win64.zip -OutFile C:\protoc\protoc.zip 7z x protoc.zip Add-Content $env:GITHUB_PATH "C:\protoc\bin" shell: powershell - name: Install npm dependencies run: | cd node npm ci - name: Build Windows native node modules run: .\ci\build_windows_artifacts.ps1 ${{ matrix.target }} - name: Upload Windows Artifacts uses: actions/upload-artifact@v3 with: name: native-windows path: | node/dist/lancedb-vectordb-win32*.tgz release: needs: [node, node-macos, node-linux, node-windows] runs-on: ubuntu-latest # Only runs on tags that matches the make-release action if: startsWith(github.ref, 'refs/tags/v') steps: - uses: actions/download-artifact@v3 - name: Display structure of downloaded files run: ls -R - uses: actions/setup-node@v3 with: node-version: 20 registry-url: 'https://registry.npmjs.org' - name: Publish to NPM env: NODE_AUTH_TOKEN: ${{ secrets.LANCEDB_NPM_REGISTRY_TOKEN }} run: | mv */*.tgz . for filename in *.tgz; do npm publish $filename done update-package-lock: needs: [release] runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 with: ref: main persist-credentials: false fetch-depth: 0 lfs: true - uses: ./.github/workflows/update_package_lock with: github_token: ${{ secrets.LANCEDB_RELEASE_TOKEN }}