The publish-release
reusable action is located at .github/workflows/publish-release.yml
.
The publish-release
GitHub Action automates publication of a new release on GitHub, updates the changelog and also publishes to the NPM registry.
NOTE: For the
release-please
workflow to work effectively, you need to follow the conventional commits conventions as detailed here. You can also find additional documentation on the GitHub Actions README.
This reusable action depends on the following actions:
The action has the following inputs:
Specify the target repository this action should run on. This is used to prevent actions from running on repositories other than the target repository. For example, specifying a target-repo
of mdn/workflows
will prevent the action from running on forks of mdn/workflows
.
- This
input
is required.
This is can be one of the release types as detailed in the release please docs.
- This
input
is optional with a default ofnode
The version of Node.js to use for the release. This action supports all active and maintenance releases of Node.js.
- This
input
is optional with a default of20
Whether to publish the package to the NPM registry.
- This
input
is optional with a default oftrue
Arguments to pass to the npm publish
command. This is ignored if npm-publish
is set to false
.
- This
input
is optional with a default of an empty string
The registry to publish to.
- This
input
is optional with a default ofhttps://registry.npmjs.org
This action requires the following secrets to be passed by the caller. Both of these need to be set as environmental secrets using the calling repositories settings.
Personal access token passed from the caller workflow. Read the documentation on creating a PA token.
Authentication token for the NPM registry. Read the documentation for details on creating a token.
NOTE: When skipping NPM publishing, this token is not required.
In the repository that will call this action, you will need to add a .github/workflows/publish-release.yml
file with the following content:
name: publish-release
on:
push:
branches:
- main
jobs:
publish-release:
uses: mdn/workflows/.github/workflows/publish-release.yml@main
with:
target-repo: "mdn/workflows"
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
name: publish-release
on:
push:
branches:
- main
jobs:
publish-release:
uses: mdn/workflows/.github/workflows/publish-release.yml@main
with:
release-type: python
target-repo: "mdn/workflows"
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
name: publish-release
on:
push:
branches:
- main
jobs:
publish-release:
uses: mdn/workflows/.github/workflows/publish-release.yml@main
with:
npm-publish: false
target-repo: "mdn/workflows"
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}