Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,49 @@ jobs:
artifacts/*
fi

# ── Publish to npm ─────────────────────────────────────────────────────
# Requires:
# 1. Package claimed on npmjs.com: @vmvarela/sql-pipe
# 2. Trusted Publishing configured on npmjs.com for repo vmvarela/sql-pipe, workflow release.yml
# 3. No NPM_TOKEN secret needed — uses OIDC (id-token: write)
publish-npm:
name: Publish to npm
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: artifacts/
merge-multiple: true

- name: Stage npm binaries
run: |
mkdir -p npm-pkg/bin
cp artifacts/sql-pipe-x86_64-linux npm-pkg/bin/sql-pipe-linux-x64
cp artifacts/sql-pipe-aarch64-linux npm-pkg/bin/sql-pipe-linux-arm64
cp artifacts/sql-pipe-armv7-linux npm-pkg/bin/sql-pipe-linux-arm
cp artifacts/sql-pipe-x86_64-macos npm-pkg/bin/sql-pipe-darwin-x64
cp artifacts/sql-pipe-aarch64-macos npm-pkg/bin/sql-pipe-darwin-arm64
cp artifacts/sql-pipe-x86_64-windows.exe npm-pkg/bin/sql-pipe-win32-x64.exe
chmod +x npm-pkg/bin/sql-pipe-linux-* npm-pkg/bin/sql-pipe-darwin-*

- name: Copy packaging files
run: |
cp -r packaging/npm/* npm-pkg/

- name: Set package version
run: |
VERSION="${GITHUB_REF_NAME#v}"
npm version "$VERSION" --no-git-tag-version --workspaces=false --prefix ./npm-pkg

- name: Publish to npm
run: npm publish ./npm-pkg --provenance --access public
continue-on-error: true

# ── Update Homebrew tap ─────────────────────────────────────────────
# Requires:
# 1. Repository: vmvarela/homebrew-tap (with a Formula/ directory)
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ By default it installs to `/usr/local/bin`. Override with `INSTALL_DIR`:
curl -sSL https://raw.githubusercontent.com/vmvarela/sql-pipe/master/install.sh | INSTALL_DIR="$HOME/.local/bin" sh
```

**npm (Node.js ≥ 18):**

```sh
npm install -g @vmvarela/sql-pipe
```

**Debian / Ubuntu (APT repository):**

```sh
Expand Down
5 changes: 5 additions & 0 deletions packaging/npm/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Include only what's in files[]
*
!bin/
!package.json
!LICENSE
37 changes: 37 additions & 0 deletions packaging/npm/bin/sql-pipe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env node

const { spawnSync } = require('child_process');
const path = require('path');

const BINARIES = {
'linux-x64': 'sql-pipe-linux-x64',
'linux-arm64': 'sql-pipe-linux-arm64',
'linux-arm': 'sql-pipe-linux-arm',
'darwin-x64': 'sql-pipe-darwin-x64',
'darwin-arm64': 'sql-pipe-darwin-arm64',
'win32-x64': 'sql-pipe-win32-x64.exe',
};

const key = `${process.platform}-${process.arch}`;
const binary = BINARIES[key];

if (!binary) {
const supported = Object.keys(BINARIES).join(', ');
console.error(
`sql-pipe: unsupported platform "${key}". Supported platforms: ${supported}`
);
process.exit(1);
}

const result = spawnSync(
path.join(__dirname, binary),
process.argv.slice(2),
{ stdio: 'inherit' }
);

if (result.error) {
console.error(`sql-pipe: failed to run binary: ${result.error.message}`);
process.exit(1);
}

process.exit(result.status === null ? 1 : result.status);
25 changes: 25 additions & 0 deletions packaging/npm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@vmvarela/sql-pipe",
"version": "0.24.0",
"description": "Read CSV from stdin, query with SQL, write CSV to stdout",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/vmvarela/sql-pipe.git"
},
"homepage": "https://github.com/vmvarela/sql-pipe",
"bugs": "https://github.com/vmvarela/sql-pipe/issues",
"bin": {
"sql-pipe": "bin/sql-pipe.js"
},
"files": [
"bin/"
],
"engines": {
"node": ">=18"
},
"keywords": [
"csv", "sql", "cli", "sqlite", "etl", "data"
],
"author": "vmvarela <vmvarela@gmail.com>"
}
Loading