Skip to content

feat: add GitHub Actions workflow for automated npm publishing and re…#5

Merged
prabothcharith merged 1 commit intomainfrom
development
Dec 15, 2025
Merged

feat: add GitHub Actions workflow for automated npm publishing and re…#5
prabothcharith merged 1 commit intomainfrom
development

Conversation

@prabothcharith
Copy link
Copy Markdown
Owner

This pull request updates the release workflow to simplify and automate publishing to npm on every merge to the main branch, regardless of version number. The previous logic that restricted publishing to certain version patterns has been removed, making the process more streamlined. Additionally, the package version has been incremented.

Workflow automation and simplification:

  • The .github/workflows/auto-publish.yml workflow was updated to trigger on every push to main and to always run the publish steps, removing all logic that previously limited publishing to only certain version numbers. This includes removing checks for major/minor/patch versions and the conditional execution of steps.
  • The workflow job was renamed from check-and-publish to publish, and unnecessary notification steps for skipped publishes were removed.

Package version update:

  • The package.json version was bumped from 1.1.0 to 1.1.1.…lease creation on main branch pushes

@prabothcharith prabothcharith self-assigned this Dec 15, 2025
Copilot AI review requested due to automatic review settings December 15, 2025 07:11
@prabothcharith prabothcharith merged commit f325f59 into main Dec 15, 2025
3 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request simplifies the automated npm publishing workflow by removing version-based conditional logic, enabling publishing on every push to the main branch. The package version has been bumped from 1.1.0 to 1.1.1.

  • Removed all conditional version checks that previously restricted publishing to specific version patterns (minor >= 2, patch = 0)
  • Simplified workflow by eliminating version parsing logic and skip notifications
  • Added error suppression (|| true) to git tag operations to handle potential duplicate tags

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
package.json Version bumped from 1.1.0 to 1.1.1
.github/workflows/auto-publish.yml Removed version-based conditional publishing logic, renamed job from 'check-and-publish' to 'publish', and removed all conditional step execution

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


- name: Publish to npm
if: steps.version.outputs.should_publish == 'true'
run: npm publish
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The npm publish step is missing the required NODE_AUTH_TOKEN environment variable. Without this authentication token, the publish command will fail. Add an env section with NODE_AUTH_TOKEN set to the npm token secret.

Suggested change
run: npm publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Copilot uses AI. Check for mistakes.
Comment on lines 39 to 40
- name: Publish to npm
if: steps.version.outputs.should_publish == 'true'
run: npm publish
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Publishing unconditionally on every push to main will fail if the version hasn't been updated, as npm doesn't allow republishing the same version. This workflow will attempt to publish version 1.1.1 again on the next merge to main, which will cause a failure. Consider adding a check to verify the version doesn't already exist on npm before attempting to publish, or implement a workflow that only publishes when the version changes.

Copilot uses AI. Check for mistakes.
Comment on lines +46 to +47
git tag -a "v${{ steps.version.outputs.package_version }}" -m "Release v${{ steps.version.outputs.package_version }}" || true
git push origin "v${{ steps.version.outputs.package_version }}" || true
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silencing errors with '|| true' on git tag and push operations masks real failures. If the tag already exists (which is expected on subsequent runs), the workflow continues, but legitimate failures like authentication issues or network problems will also be hidden. Consider using conditional logic to check if the tag exists first, or handle specific error cases explicitly rather than suppressing all errors.

Suggested change
git tag -a "v${{ steps.version.outputs.package_version }}" -m "Release v${{ steps.version.outputs.package_version }}" || true
git push origin "v${{ steps.version.outputs.package_version }}" || true
TAG="v${{ steps.version.outputs.package_version }}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists. Skipping tag creation and push."
else
git tag -a "$TAG" -m "Release $TAG"
git push origin "$TAG"
fi

Copilot uses AI. Check for mistakes.
@prabothcharith prabothcharith review requested due to automatic review settings March 23, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants