You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve/automate package.json version bumping on NPM publish & release drafter #1533
As of #1520, our NPM workflow automatically publishes to NPM whenever we publish a GitHub release. However, it relies on us manually bumping the package.jsons and it doesn't check whether this has been done. If the package.json versions aren't bumped (particularly the main @finos/git-proxy version), this can override existing releases or mess up subsequent release-drafter.yml executions.
Describe the solution you'd like
We should at least check whether a package.json version bump has occurred, and fail the workflow if so.
Ideally, we would have some script that runs automatically to bump the versions appropriately, perhaps during the release-drafter.yml step which computes the next semantic version. This could create a PR that bumps all the relevant package.jsons (currently ./package.json and ./packages/git-proxy-cli/package.json), which we then review/merge to trigger the actual GitHub release, which will in turn create a valid NPM release.
If we go with the auto-bumping script/workflow, we still need to check before running the NPM workflow in case someone forgot to merge the generated bump PR.
Also, the Releases.md doc should be updated to reflect the improved flow.
There was an action we used to use in the FDC3 repo to check if the version exists on NPM, which effectively accomplished the version bump check, I think the current version just tries to publish and then fails out as that project is similarly manually bumping.
Something like this could work:
name: Check npm version
on:
release:
types: [created] # Trigger when a release is created
workflow_dispatch: # Optional manual trigger
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Get package name and version
id: pkg
run: |
NAME=$(node -p "require('./package.json').name")
VERSION=$(node -p "require('./package.json').version")
echo "name=$NAME" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Check if version exists on npm
id: check
run: |
PACKAGE=${{ steps.pkg.outputs.name }}
VERSION=${{ steps.pkg.outputs.version }}
echo "Checking $PACKAGE@$VERSION on npm..."
if npm view "$PACKAGE@$VERSION" version > /dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Fail if version already exists
if: steps.check.outputs.exists == 'true'
run: |
echo "❌ Version already exists on npm. Did you forget to bump it?"
exit 1
- name: Success
if: steps.check.outputs.exists == 'false'
run: |
echo "✅ Version does not exist yet. Good to publish."
Or there's a prebuilt action:
- name: Check publish status
id: check
uses: tehpsalmist/npm-publish-status-action@v1
- name: Fail if version already exists
if: ${{ steps.check.outputs.exists == '1' }}
run: |
echo "❌ Version already exists on npm"
exit 1
Finally, conventional commits is designed to help us do this and most users of it automate verison bumps using it:
if all the commits are chore, docs and fix: bump patch version
if there are feat commits: bump minor version
if there are breaking changes (! appended - theres an alternative syntax that means the same): bump major version
Here's a co-pilot's suggestions on actions to handle that:
There are quite a few solid GitHub Actions for auto‑versioning based on Conventional Commits. They fall into three main categories:
Activity
kriswest commentedon May 13, 2026
There was an action we used to use in the FDC3 repo to check if the version exists on NPM, which effectively accomplished the version bump check, I think the current version just tries to publish and then fails out as that project is similarly manually bumping.
Something like this could work:
Or there's a prebuilt action:
Finally, conventional commits is designed to help us do this and most users of it automate verison bumps using it:
!appended - theres an alternative syntax that means the same): bump major versionHere's a co-pilot's suggestions on actions to handle that:
jescalada commentedon Jul 1, 2026
@kriswest I opted for a custom GitHub Action that just bumps our relevant
package.jsons when a milestone is closed (or triggered manually). #1627