Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I auto-generate a release note and create a release using Github Actions

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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 main branch could look like this:

name: Create release

on:
  push:
    tags:
      - v*

jobs:
  release:
    name: Release pushed tag
    runs-on: ubuntu-22.04
    steps:
      - name: Extract tag
        id: tag
        env:
          ref: ${{ github.event.push.ref }}
        run: |
          echo "tag=${ref##*/}" >> "$GITHUB_OUTPUT"
         
      - name: Create release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          tag: ${{ steps.tag.outputs.tag }} 
        run: |
          gh release create "$tag" \
              --repo="$GITHUB_REPOSITORY" \
              --title="${GITHUB_REPOSITORY#*/} ${tag#v}" \
              --generate-notes
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading