diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c9578eef..a6c9c339 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: @@ -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 "office@geowerkstatt.ch" + 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 ""