Skip to content

Git Changelog GitHub Release

Actions
Drafts release with template using Git Changelog Lib
1.5.2
Latest
Star (0)

Tags

 (1)

Git Changelog Github Release Action

This is a GitHub action that can draft release in GitHub generated from template using git-changelog-lib.

  • You can have it running on your default branch, not depending on pull-requests.
  • Uses conventional commits to keep a draft release updated and ready to be published.
    • It will parse any commit in branch and construct the draft description from that.
    • It will adjust the draft version based on conventional commits.

Draft releases

  • Create a file, perhaps .github/workflows/draft-release.yaml, with content:
name: Git Changelog Github Release

on: [workflow_dispatch, workflow_call, push]

jobs:
  build:
    runs-on: 'ubuntu-latest'
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-tags: 'true'
          fetch-depth: '0'
      - name: Setup java
        uses: actions/setup-java@v2
        with:
          distribution: 'zulu'
          java-version: 17
      - uses: tomasbjerre/git-changelog-github-release@main
        env:
          # Needs write permission in Github menu '/settings/actions'
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Running example in this repo.

Triggering release when publishing draft

You may want to have GitHub trigger a workflow when drafted release is published. Perhaps to build it and upload a release. Perhaps something like this:

name: Release
on:
  release:
    types: [published]
jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
    steps:
      - name: Determine new version
        id: new_version
        run: |
          NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
          echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
      - name: Publish
        run:
          echo Whatever command to release version ${{
          steps.new_version.outputs.new_version }}

Publish releases when tags pushed

If you already have some other way of releasing, you may want to just publish those releases.

This will render the release content with the difference between the last 2 tags.

name: Publish release on tag push

on:
  workflow_dispatch:
  workflow_call:
  push:
    tags:
      - '*'

jobs:
  build:
    runs-on: 'ubuntu-latest'
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-tags: 'true'
          fetch-depth: '0'
      - name: Setup java
        uses: actions/setup-java@v2
        with:
          distribution: 'zulu'
          java-version: 17
      - uses: tomasbjerre/git-changelog-github-release@main
        env:
          # Needs write permission in Github menu '/settings/actions'
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          draft: false

Running example in this repo.

Git Changelog GitHub Release is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Drafts release with template using Git Changelog Lib
1.5.2
Latest

Tags

 (1)

Git Changelog GitHub Release is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.