docs
docs copied to clipboard
Automatically publish package to NPM on release.
Code of Conduct
- [X] I have read and agree to the GitHub Docs project's Code of Conduct
What article on docs.github.com is affected?
https://github.com/github/docs/blob/main/content/actions/publishing-packages/publishing-nodejs-packages.md
What part(s) of the article would you like to see updated?
Summary
The event trigger in the following example does not perform the function described in the docs. I experimented after looking for various event triggers and was able to do what was suggested by using 'published' instead of 'created'.
Current example
# ...
on:
release:
types: [created]
# ...
Suggested changes
## ...
on:
release:
types: ['published']
## ...
Other changes
If this change is applied I also suggest to update the following:
## Publishing packages to the npm registry
Each time you create a new release, you can trigger a workflow to publish your package. The workflow in the example below runs when the `release` event triggers with type `created`. The workflow publishes the package to the npm registry if CI tests pass.
To:
## Publishing packages to the npm registry
You can trigger a workflow to publish your NPM package every time you [publish a new release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release). The process in the following example is executed when the release event of type 'published' is triggered. If the CI tests pass, the process uploads the package to the npm registry.
Additional information
You can see a working example in this project. Before this commit I used the exact same example as suggest in the docs, but after creating the releases the workflow was not triggered. The NPM package was only published after I change the event trigger as mentioned previously.
Thanks for opening this issue. A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.
@santosned Thanks so much for opening an issue! I'll triage this for the team to take a look :eyes:
Thanks for opening this issue! Your proposed changes sound good to me. You or anyone else is welcome to open a PR to address this issue.