mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-11 22:53:04 +00:00
* fix(ci): build gitnexus-shared before publish, use CHANGELOG for release notes The publish workflow was missing the gitnexus-shared build step that the setup-gitnexus composite action provides. Since PR #536 unified the ingestion pipeline, gitnexus imports types from gitnexus-shared, so it must be built first. Also replaces generate_release_notes with CHANGELOG.md extraction so GitHub Releases use the reviewed changelog entry instead of a flat PR title list. Made-with: Cursor * fix: bundle gitnexus-shared into CLI dist to fix module resolution gitnexus-shared was declared as a file: dependency but never published to npm, causing ERR_MODULE_NOT_FOUND for users installing gitnexus globally. The build script now copies gitnexus-shared/dist into dist/_shared/ and rewrites bare specifiers to relative paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: move gitnexus-shared to devDependencies, use tsc for prepare gitnexus-shared must remain available for tsc to resolve imports during development/CI, but is not needed at runtime since it's bundled into dist/_shared/. Moving it to devDependencies keeps it out of production installs while allowing compilation. The prepare script now runs plain tsc (no shared bundling needed for local dev). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Abhigyan Patwari <abhigyan@Abhigyans-MacBook-Air.local> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
88 lines
2.8 KiB
YAML
88 lines
2.8 KiB
YAML
name: Publish to npm
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
# No workflow-level permissions — scoped per job below.
|
|
|
|
jobs:
|
|
ci:
|
|
uses: ./.github/workflows/ci.yml
|
|
permissions:
|
|
contents: read
|
|
actions: read
|
|
pull-requests: write
|
|
|
|
publish:
|
|
needs: ci
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
with:
|
|
node-version: 20
|
|
registry-url: https://registry.npmjs.org
|
|
cache: npm
|
|
cache-dependency-path: gitnexus/package-lock.json
|
|
- name: Build gitnexus-shared
|
|
run: npm install && npm run build
|
|
working-directory: gitnexus-shared
|
|
|
|
- run: npm ci
|
|
working-directory: gitnexus
|
|
|
|
- name: Verify version consistency
|
|
shell: bash
|
|
run: |
|
|
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
|
|
if ! [[ "$TAG_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
|
|
echo "::error::Tag does not follow semver: v$TAG_VERSION"
|
|
exit 1
|
|
fi
|
|
PKG_VERSION=$(node -p "require('./package.json').version")
|
|
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
|
|
echo "::error::Tag version (v$TAG_VERSION) does not match package.json version ($PKG_VERSION)"
|
|
exit 1
|
|
fi
|
|
echo "Version verified: $PKG_VERSION"
|
|
working-directory: gitnexus
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
working-directory: gitnexus
|
|
|
|
- name: Dry-run publish
|
|
run: npm publish --dry-run
|
|
working-directory: gitnexus
|
|
|
|
- name: Publish to npm
|
|
run: npm publish --provenance --access public
|
|
working-directory: gitnexus
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
- name: Extract release notes from CHANGELOG
|
|
id: changelog
|
|
shell: bash
|
|
run: |
|
|
VERSION="${GITHUB_REF#refs/tags/v}"
|
|
NOTES=$(awk "/^## \\[$VERSION\\]/{found=1; next} /^## \\[/{if(found) exit} found" gitnexus/CHANGELOG.md)
|
|
if [ -z "$NOTES" ]; then
|
|
echo "::warning::No CHANGELOG entry found for v$VERSION, falling back to auto-generated notes"
|
|
echo "fallback=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "$NOTES" > /tmp/release-notes.md
|
|
echo "fallback=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2
|
|
with:
|
|
body_path: ${{ steps.changelog.outputs.fallback == 'false' && '/tmp/release-notes.md' || '' }}
|
|
generate_release_notes: ${{ steps.changelog.outputs.fallback == 'true' }}
|