ci: add GitHub Actions workflow for npm publish

This commit is contained in:
Lantanios 2026-01-29 11:52:57 -05:00
parent c10f5dbfb9
commit 4882d8821e

46
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,46 @@
name: Publish to npm
on:
push:
branches:
- lantanios
workflow_dispatch:
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Update package name for scoped publish
run: |
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
pkg.name = '@lantanios/moltbot';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
"
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}