Skip to content

chore: release v1.14.0 #46

chore: release v1.14.0

chore: release v1.14.0 #46

Workflow file for this run

name: Publish to npm and GitHub Packages
on:
push:
tags:
- 'v*'
jobs:
publish-npm:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Verify tag matches package version
run: |
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
PKG_VERSION=$(node -p "require('./apps/skillkit/package.json').version")
echo "Tag version: $TAG_VERSION"
echo "Package version: $PKG_VERSION"
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "❌ Tag version ($TAG_VERSION) doesn't match package version ($PKG_VERSION)"
echo "Please update package versions before creating the release tag."
exit 1
fi
echo "✓ Version check passed"
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Test
run: pnpm test
- name: Publish packages to npm
run: pnpm -r publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
publish-github-packages:
runs-on: ubuntu-latest
needs: publish-npm
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js for GitHub Packages
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
registry-url: 'https://npm.pkg.github.com'
scope: '@rohitg00'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Configure npm for GitHub Packages
run: |
echo "@rohitg00:registry=https://npm.pkg.github.com" >> .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
- name: Publish main skillkit package to GitHub Packages
working-directory: apps/skillkit
run: |
# Create a temporary package.json with GitHub Packages scope and resolved dependencies
node -e "
const fs = require('fs');
const path = require('path');
const pkg = require('./package.json');
pkg.name = '@rohitg00/skillkit';
pkg.publishConfig = { registry: 'https://npm.pkg.github.com' };
// Resolve workspace:* dependencies to actual versions
for (const [dep, version] of Object.entries(pkg.dependencies || {})) {
if (version.startsWith('workspace:')) {
const depName = dep.replace('@skillkit/', '');
const depPkgPath = path.join('..', '..', 'packages', depName, 'package.json');
const depPkg = JSON.parse(fs.readFileSync(depPkgPath, 'utf8'));
pkg.dependencies[dep] = depPkg.version;
}
}
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
"
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}