Draft GitHub releases and automate versioning based on conventional commit messages.
Here is a git graph, demonstrating how the release strategy would look like:
gitGraph
commit tag: "v1.0.0"
branch features/my-awesome-idea
commit
commit id: "fix: fixed linting errors"
checkout main
merge features/my-awesome-idea tag: "v1.0.1"
branch features/my-second-idea
commit id: "feat:adding new calculator to calculate prices"
checkout main
merge features/my-second-idea tag: "v1.1.0"
branch features/my-third-idea
commit
commit id: "BREAKING CHANGE:removed database connection"
checkout main
merge features/my-third-idea tag: "v2.0.0"
- uses: KoblerS/release-drafter@v1
The available parameters are optional:
token
: (default) the GitHub token that will be used for authenticationgenerate-release-notes
:true
(default) adds the existing commit messages to the release notes,false
leaves the release notes emptyversion-prefix
:v
prepends a prefix to the version number
Important
Important note: Make sure to set the correct permissions for your action:
permissions:
# Required to request the OIDC JWT Token
id-token: write
# Required when GH token is used to authenticate with private repo
contents: write
In order to continue workflow code the following output parameters are set:
release-id
: GitHub internal id of the created releaseversion
: Version code of the created releaseraw-version
: Version code withoutv
prefix
This action analyzes commit messages to assess the impact of changes on the codebase. By adhering to standardized commit message conventions, it automatically calculates the next semantic version number, generates a changelog, and drafts a release on GitHub.
Tools like commitizen or commitlint can assist contributors in creating valid commit messages.
The examples below illustrate which commit messages trigger specific release types when semantic-release is executed (using the default configuration):
fix(api): fixed API endpoint to get the communication working
docs: added infrastructure diagram
test: added unit tests for src/calculator.ts
For a comprehensive list of keywords, refer to src/version-helper.ts.
feat(calculation): implemented salary income calculator
Ensure the BREAKING CHANGE:
token is at the beginning of the line.
perf(pencil): remove graphiteWidth option
BREAKING CHANGE: The graphiteWidth option has been removed.
The default graphite width of 10mm is always used for performance reasons.
refactor!: refactored API endpoints to noun-based approach
major: enforcing OAuth authentication for all API endpoints