Skip to content

Publish better-sqlite3 N-API prebuilds #42

Publish better-sqlite3 N-API prebuilds

Publish better-sqlite3 N-API prebuilds #42

name: Publish better-sqlite3 N-API prebuilds
# Repacks the N-API prebuilds bundled in a better-sqlite3-multiple-ciphers npm
# release (v13+, one binary per platform) into the platform-keyed tarballs the
# DBCode extension fetches at runtime. Replaces the old update-better-sqlite3
# mirror (which read GitHub release assets that v13+ no longer publishes).
#
# The daily cron tracks the latest npm version and opens a PR when public does
# not yet have it (a human reviews/merges; the extension pins its own version,
# so newer binaries sit unused until a code bump references them). The v12
# fallback prebuilds are maintained separately by the build-better-sqlite3-*
# self-build workflows.
on:
schedule:
# Daily at 7 AM UTC (same slot the old mirror used).
- cron: '0 7 * * *'
workflow_dispatch:
inputs:
version:
description: Version to pack (npm, e.g. 13.0.3). Empty = latest.
required: false
default: ''
permissions:
contents: write
pull-requests: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
- name: Resolve version
id: v
env:
# Route the dispatch input through env so it is never interpolated
# into a shell command line (avoids a script-injection shape).
INPUT_VERSION: ${{ inputs.version }}
run: |
if [ -n "$INPUT_VERSION" ]; then
VERSION="$INPUT_VERSION"
else
VERSION=$(npm view better-sqlite3-multiple-ciphers version)
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Resolved better-sqlite3-multiple-ciphers version: $VERSION"
- name: Check whether already published
id: check
env:
VERSION: ${{ steps.v.outputs.version }}
run: |
# darwin-arm64 stands in for the whole 8-file set - they are packed together.
if [ -f "packages/better-sqlite3/better-sqlite3-multiple-ciphers-v$VERSION-darwin-arm64.tar.gz" ]; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "v$VERSION already present, nothing to do."
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Repack N-API prebuilds
if: steps.check.outputs.exists == 'false'
env:
VERSION: ${{ steps.v.outputs.version }}
run: node .github/scripts/pack-bsmc-napi.mjs "$VERSION"
- name: Create Pull Request
if: steps.check.outputs.exists == 'false'
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
add-paths: packages/better-sqlite3
branch: bsmc-napi-${{ steps.v.outputs.version }}
delete-branch: true
title: better-sqlite3-multiple-ciphers v${{ steps.v.outputs.version }} N-API prebuilds
commit-message: better-sqlite3-multiple-ciphers v${{ steps.v.outputs.version }} N-API prebuilds
body: |
Platform-keyed N-API prebuilds for better-sqlite3-multiple-ciphers
v${{ steps.v.outputs.version }}, repacked from the npm package's bundled
prebuilds by `.github/scripts/pack-bsmc-napi.mjs`.
Consumed by DBCode's SQLite driver at runtime. Auto-generated by the
publish-better-sqlite3-napi workflow.