chore: automate npm release workflow#5
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the release workflow to automate publishing via GitHub Actions by modifying the release scripts in package.json to push to the repository instead of publishing directly. The documentation in README.md was also updated to reflect this change. Feedback suggests using git push --follow-tags to avoid pushing unintended local tags and identifies a contradiction in the documentation that needs to be resolved.
| "release:patch": "npm run test && npm version patch && git push origin HEAD && git push origin --tags", | ||
| "release:minor": "npm run test && npm version minor && git push origin HEAD && git push origin --tags", | ||
| "release:major": "npm run test && npm version major && git push origin HEAD && git push origin --tags", |
There was a problem hiding this comment.
Using git push origin --tags is generally discouraged because it pushes all local tags to the remote repository, which may include unintended or temporary tags. A safer and more efficient approach is to use git push origin HEAD --follow-tags. This command pushes the current branch and only the annotated tags (such as the one created by npm version) that are reachable from the commits being pushed.
| "release:patch": "npm run test && npm version patch && git push origin HEAD && git push origin --tags", | |
| "release:minor": "npm run test && npm version minor && git push origin HEAD && git push origin --tags", | |
| "release:major": "npm run test && npm version major && git push origin HEAD && git push origin --tags", | |
| "release:patch": "npm run test && npm version patch && git push origin HEAD --follow-tags", | |
| "release:minor": "npm run test && npm version minor && git push origin HEAD --follow-tags", | |
| "release:major": "npm run test && npm version major && git push origin HEAD --follow-tags", |
|
|
||
| Cada comando ejecuta tests, actualiza `version` y crea localmente el tag `vX.Y.Z`, luego publica el paquete. | ||
|
|
||
| El flujo recomendado ahora es automático: los scripts de release hacen `git push` del commit y del tag, y GitHub Actions publica a npm usando `NPM_TOKEN` y crea el GitHub Release. |
There was a problem hiding this comment.
The addition of this paragraph introduces a contradiction with line 67, which still states that the release commands publish the package locally ('luego publica el paquete'). Since the scripts in package.json have been updated to only push to the repository and rely on GitHub Actions for publishing, line 67 should be updated to remove the mention of local publishing to avoid confusion for users.
Summary
repository.urlinpackage.jsonto the canonical npm-friendly git URLrelease:patch,release:minor, andrelease:majorto push the version bump commit and tag instead of publishing locallyv*tagNPM_TOKENin the repository secrets for automated publishingWhy
The package is already published on npm, but future releases should be fully automated and reproducible from the repository workflow instead of requiring a local manual
npm publish.Test Plan
npm testnpm run build