Skip to content

release: v2.6.0 — changelog tab, version bump, pre-publish fixes #3

release: v2.6.0 — changelog tab, version bump, pre-publish fixes

release: v2.6.0 — changelog tab, version bump, pre-publish fixes #3

Workflow file for this run

name: Publish to npm & GitHub Packages
on:
push:
tags:
- 'v*'
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
# ── Publish to npm ─────────────────────────────────────────
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# ── Publish to GitHub Packages ─────────────────────────────
# GitHub Packages requires a scoped package name (@owner/package)
- name: Setup Node.js for GitHub Packages
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://npm.pkg.github.com'
scope: '@brian-mwirigi'
- name: Publish to GitHub Packages
run: |
# Rename package to scoped name for GitHub Packages only
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json','utf8'));
pkg.name = '@brian-mwirigi/codesession-cli';
pkg.publishConfig = { registry: 'https://npm.pkg.github.com' };
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
"
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ── Create GitHub Release ──────────────────────────────────
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
body: |
See [CHANGELOG.md](https://github.com/brian-mwirigi/codesession-cli/blob/main/CHANGELOG.md) for full details.
**Install:**
```bash
npm install -g codesession-cli
```