feat: add GitHub Actions workflow for automated npm publishing and re…#5
feat: add GitHub Actions workflow for automated npm publishing and re…#5prabothcharith merged 1 commit intomainfrom
Conversation
…lease creation on main branch pushes
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
| run: npm publish | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| - name: Publish to npm | ||
| if: steps.version.outputs.should_publish == 'true' | ||
| run: npm publish |
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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.
| 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 |
This pull request updates the release workflow to simplify and automate publishing to npm on every merge to the
mainbranch, 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:
.github/workflows/auto-publish.ymlworkflow was updated to trigger on every push tomainand 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.check-and-publishtopublish, and unnecessary notification steps for skipped publishes were removed.Package version update:
package.jsonversion was bumped from1.1.0to1.1.1.…lease creation on main branch pushes