Skip to content

Commit

Permalink
Patch changelog automatically on release
Browse files Browse the repository at this point in the history
  • Loading branch information
flenny committed Apr 26, 2024
1 parent f04a46c commit 9da9bf4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:

env:
REGISTRY: ghcr.io
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}

jobs:
Expand Down Expand Up @@ -60,3 +61,29 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:edge
cache-to: type=inline

patch-changelog:
runs-on: ubuntu-latest
name: Patch CHANGELOG.md

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set environment variables
run: |
echo GIT_BRANCH_NAME=mark-version-${TAG_NAME#v}-as-released >> $GITHUB_ENV
echo GIT_COMMIT_MESSAGE=Mark version ${TAG_NAME#v} as released >> $GITHUB_ENV
- name: Checkout new branch and patch changelog
run: |
git checkout -b $GIT_BRANCH_NAME
sed -i "/^\#\# \[Unreleased\]$/a \\\n\#\# $TAG_NAME - $(date '+%Y-%m-%d')" CHANGELOG.md
- name: Commit, push and create pull request
run: |
git config --global user.email "[email protected]"
git config --global user.name "GeoWerkstatt-Build"
git commit -am "$GIT_COMMIT_MESSAGE"
git push --set-upstream origin $GIT_BRANCH_NAME
gh pr create --title "$GIT_COMMIT_MESSAGE" --body ""

0 comments on commit 9da9bf4

Please sign in to comment.