I am trying to create a Github Action job that will automatically generate a release note and create a release based on that note. I have found an action called "actions/create-release", but it is only good for creating the release, and does not provide a way to automatically generate the release note.
- name: Create-Release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "${{ env.ver }}"
release_name: "${{ env.ver }}"
draft: false
prerelease: false
Moreover, I have also learned that the "actions/create-release" repository is now obsolete, and no further updates will be provided for it. Therefore, I am seeking an alternative solution to accomplish my goal.
What is the best way to auto-generate a release note and create a release using Github Actions? Are there any recommended actions or workflows that can achieve this without relying on the now-obsolete "actions/create-release" repository?
This can be done using the GitHub CLI and a run
step. For example, a workflow that creates a release for any tag pushed to the GitHub hosted repository could look like this:
name: Create release
on:
push:
tags:
- v*
permissions:
contents: write
jobs:
release:
name: Release pushed tag
runs-on: ubuntu-24.04
steps:
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} ${tag#v}" \
--generate-notes
FWIW, this action has worked well for me. I have it configured to add a release draft when a PR is merged into main
and auto-generate notes for me. It seems pretty robust with a lot of options and is updated fairly recently (Feb 2nd, 2024 as of this post.)
https://github.com/marketplace/actions/release-drafter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With