Creating a release and publishing the package
In this recipe, we are going to create a workflow that will publish our package whenever a release is created.
Getting ready
Create a new branch:
$ git switch -c add-release-workflow
How to do it…
- Create a new
.github/workflows/release.yml
workflow file. Name the workflowRelease
and trigger it on the creation of GitHub releases:name: Release on: release: types: [created]
- Add a
publish
job and give it read permission for the repository and write for packages:jobs: publish: runs-on: ubuntu-latest permissions: packages: write contents: read
- Check out the code and configure the NodeJS environment with the correct version. Also, set the registry to use GitHub:
steps: - uses: actions/checkout@v4 - uses: actions/setup-node...