thomaseizinger / keep-a-changelog-new-release

Automatically update your CHANGELOG.md for a new release

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make the action create an output with the release section text

thomaseizinger opened this issue · comments

This output can then be used by the create-release action to put it in the release body.

I managed to add the content of the CHANGELOG file to the release GitHub Release notes using the following workflow:

name: "Publish new release"

on:
  pull_request:
    branches:
      - 1.x
    types:
      - closed

jobs:
  release:
    name: Publish new release
    runs-on: ubuntu-20.04
    if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Extract version from branch name (for release branches)
        run: |
          BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
          VERSION=${BRANCH_NAME#release/}

          echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV

      - name: Parse Changelog Entry
        id: changelog
        uses: coditory/changelog-parser@v1
        with:
          version: ${{ env.RELEASE_VERSION }}

      - name: Create Release
        uses: thomaseizinger/create-release@1.0.0
        env:
          GITHUB_TOKEN: ${{ secrets.PAT }}
        with:
          target_commitish: ${{ github.event.pull_request.merge_commit_sha }}
          tag_name: ${{ env.RELEASE_VERSION }}
          name: ${{ env.RELEASE_VERSION }}
          body: ${{ steps.changelog.outputs.description }}
          draft: false
          prerelease: false

The action coditory/changelog-parser@v1 is parsing the changelog file. The output can then simply be passed to the thomaseizinger/create-release@1.0.0 action.

I think therefore it is not needed to integrate that feature into this action. Especially, that the content should be parsed after merging to the main branch again, because the changelog could be edited in the release PR.

Nice, thank you for sharing! I'll consider this ticket obsolete then :)