Merge pull request 'feat(release): add workflow for creating release tags and update CHANGELOG.md' (#22) from patch-2-gitea-registry into main
Tests / build-dev (push) Skipped
Tests / build-prod (push) Skipped

Reviewed-on: #22
This commit was merged in pull request #22.
This commit is contained in:
2026-07-31 12:58:05 +00:00
2 changed files with 66 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
# Cuts a release: moves CHANGELOG.md's [Unreleased] section under a new
# version heading, commits it to main, then creates and pushes the version tag.
# Trigger manually via workflow_dispatch, entering the semver to release.
# The pushed tag can then be built with docker-publish.yml.
name: Create Release Tag
on:
workflow_dispatch:
inputs:
version:
description: "Version to release (semver, e.g. 1.2.3)"
required: true
type: string
jobs:
tag:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Validate version and Unreleased section
run: |
if ! [[ "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: '${{ inputs.version }}' is not a valid semver (e.g. 1.2.3)."
exit 1
fi
if git rev-parse "refs/tags/${{ inputs.version }}" >/dev/null 2>&1; then
echo "Error: tag '${{ inputs.version }}' already exists."
exit 1
fi
awk '/^## \[Unreleased\]/{f=1;next}/^## \[/{f=0}f' CHANGELOG.md > /tmp/unreleased.md
if ! grep -q '[^[:space:]]' /tmp/unreleased.md; then
echo "Error: CHANGELOG.md's [Unreleased] section is empty — nothing to release."
exit 1
fi
- name: Move Unreleased entries under the new version heading
run: |
today=$(date +%Y-%m-%d)
awk -v ver="${{ inputs.version }}" -v date="$today" '
/^## \[Unreleased\]/ { print; print ""; print "## [" ver "] - " date; next }
{ print }
' CHANGELOG.md > /tmp/CHANGELOG.md
mv /tmp/CHANGELOG.md CHANGELOG.md
- name: Commit and tag
run: |
git config user.name "gitea-actions"
git config user.email "actions@noreply.git.arthurerlich.de"
git add CHANGELOG.md
git commit -m "chore(release): ${{ inputs.version }}"
git tag "${{ inputs.version }}"
git push origin HEAD:main
git push origin "${{ inputs.version }}"
+4
View File
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Fixed
- Removed a leftover `composer dump-env prod` call in the prod Docker build stage — the command doesn't exist in this project's Composer setup and broke every image build
## [0.2.0] - 2026-07-12 ## [0.2.0] - 2026-07-12
### Added ### Added