The “Create Release” workflow, defined in .github/workflows/release-on-tag.yml
, automates the process of creating a new GitHub release whenever a new tag is pushed to the repository.
This workflow is triggered when a push
event occurs with a tag that matches the pattern v*.*.*
(e.g., v1.0.0
, v2.3.4
).
build
This job runs on ubuntu-latest
and has contents: write
permissions to allow it to create a release. It performs the following steps:
Checkout code: Checks out the repository’s code. fetch-depth: 0
is used to fetch all history for all branches and tags, which is necessary for generating the changelog.
HEAD
. The changelog format is a list of commit messages, each with a link to the corresponding commit..github/RELEASE_BODY.md
and substituting the ${TAG}
placeholder with the current tag name.FINAL_BODY
output.Get Release Title: This step reads the release title template from .github/RELEASE_TITLE.txt
, replaces the ${TAG}
placeholder with the current tag name, and sets the result as an output named title
.
softprops/action-gh-release
action to create the GitHub release. It uses the title and body generated in the previous steps, and sets the tag_name
to the tag that triggered the workflow. The release is created as a full release (not a draft or pre-release).This workflow streamlines the release process by automating the creation of well-formatted, consistent GitHub releases based on Git tags.