semantic-release plugin to publish a GitHub release and comment on released Pull Requests/Issues.
Step | Description |
---|---|
verifyConditions |
Verify the presence and the validity of the authentication (set via environment variables) and the assets option configuration. |
publish |
Publish a GitHub release, optionally uploading file assets. |
addChannel |
Update a GitHub release's pre-release field. |
success |
Add a comment to each GitHub Issue or Pull Request resolved by the release and close issues previously open by the fail step. |
fail |
Open or update a GitHub Issue with information about the errors that caused the release to fail. |
$ npm install @semantic-release/github -D
The plugin can be configured in the semantic-release configuration file:
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/github",
{
"assets": [
{ "path": "dist/asset.min.css", "label": "CSS distribution" },
{ "path": "dist/asset.min.js", "label": "JS distribution" }
]
}
]
]
}
With this example GitHub releases will be published with the file dist/asset.min.css
and dist/asset.min.js
.
The GitHub authentication configuration is required and can be set via environment variables.
Follow the Creating a personal access token for the command line documentation to obtain an authentication token. The token has to be made available in your CI environment via the GH_TOKEN
environment variable. The user associated with the token must have push permission to the repository.
When creating the token, the minimum required scopes are:
repo
for a private repositorypublic_repo
for a public repository
Note on GitHub Actions: You can use the default token which is provided in the secret GITHUB_TOKEN. However releases done with this token will NOT trigger release events to start other workflows. If you have actions that trigger on newly created releases, please use a generated token for that and store it in your repository's secrets (any other name than GITHUB_TOKEN is fine).
When using the GITHUB_TOKEN, the minimum required permissions are:
contents: write
to be able to publish a GitHub releaseissues: write
to be able to comment on released issuespull-requests: write
to be able to comment on released pull requests
Variable | Description |
---|---|
GITHUB_TOKEN or GH_TOKEN |
Required. The token used to authenticate with GitHub. |
GITHUB_URL or GH_URL |
The GitHub server endpoint. |
GITHUB_PREFIX or GH_PREFIX |
The GitHub API prefix, relative to GITHUB_URL . |
GITHUB_API_URL |
The GitHub API endpoint. Note that this overwrites GITHUB_PREFIX . |