update better-sqlite + prebuild for node 24 #24
Workflow file for this run
This file contains hidden or 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: Build & Publish | |
| on: | |
| push: | |
| tags: ['v*'] # publish when you push a tag like v1.2.3 | |
| workflow_dispatch: {} | |
| # New publication workflow with OIDC authentication https://docs.npmjs.com/trusted-publishers | |
| # THe Github CI is declared on NPM as a trusted publisher | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.os }} / ${{ matrix.arch }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux | |
| - os: ubuntu-24.04 | |
| platform: linux | |
| arch: x64 | |
| - os: ubuntu-24.04 | |
| platform: linux | |
| arch: arm64 | |
| # macOS | |
| - os: macos-15 # Apple Silicon runner; clang can cross-compile x64 too | |
| platform: darwin | |
| arch: arm64 | |
| - os: macos-15 | |
| platform: darwin | |
| arch: x64 | |
| # Windows | |
| # - os: windows-2022 | |
| # platform: win | |
| # arch: x64 | |
| # - os: windows-2022 | |
| # platform: win | |
| # arch: arm64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup node using cache (faster) | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| - run: npm ci --production | |
| # ----- Linux: prepare cross toolchain for arm64 ----- | |
| - name: Install aarch64 cross toolchain (Linux arm64) | |
| if: matrix.platform == 'linux' && matrix.arch == 'arm64' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
| echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
| echo "CXX=aarch64-linux-gnu-g++" >> $GITHUB_ENV | |
| - run: npx node-gyp rebuild --arch=${{ matrix.arch }} | |
| # ----- Collect and normalize the output name ----- | |
| - name: Stage artifact (Linux/macOS) | |
| if: matrix.platform != 'win' | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.platform }}" = "darwin" ]; then ext="dylib"; else ext="so"; fi | |
| cp "build/Release/keep_last.$ext" build/Release/keep_last-${{ matrix.platform }}-${{ matrix.arch }}.$ext | |
| # ----- Upload per-target artifact ----- | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: replic-sqlite-${{ matrix.platform }}-${{ matrix.arch }} | |
| path: build/Release/keep_last-${{ matrix.platform }}-${{ matrix.arch }}.* | |
| pack: | |
| name: Assemble & Publish | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist/ | |
| merge-multiple: true | |
| # List all files for debugging | |
| - name: List all files (debug) | |
| run: | | |
| echo "Listing all files recursively from workspace root:" | |
| find . -type f -print | sort | |
| - name: Setup Node (for publish) | |
| uses: actions/setup-node@v4 | |
| with: | |
| # Required for OIDC authentication | |
| node-version: '24' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Preview npm tarball | |
| run: npm pack --dry-run | |
| - name: Publish to npm | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: npm publish |