docs icon indicating copy to clipboard operation
docs copied to clipboard

Automatically publish package to NPM on release.

Open edubycode opened this issue 2 years ago • 2 comments

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.

edubycode avatar Jan 25 '23 22:01 edubycode

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.

welcome[bot] avatar Jan 25 '23 22:01 welcome[bot]

@santosned Thanks so much for opening an issue! I'll triage this for the team to take a look :eyes:

cmwilson21 avatar Jan 26 '23 15:01 cmwilson21

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.

skedwards88 avatar Feb 02 '23 19:02 skedwards88