From 399168e4eb3a17352d90607d817b49e0e4338756 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Wed, 25 Feb 2026 21:39:39 +0100 Subject: [PATCH] **feat(ci):** enhance release workflow with changelog generation and detailed release body - Add `jq` dependency for JSON manipulation - Automatically generate changelog from Git history for releases - Refactor release body to include Docker image details and formatted changelog Changelog: other --- .gitea/workflows/release.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 5d2b7d3..e073de1 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -50,7 +50,7 @@ jobs: DOCKER_HOST: tcp://dind:2375 steps: - name: Install dependencies - run: apk add --no-cache git curl + run: apk add --no-cache git curl jq - name: Checkout with full history run: | @@ -106,8 +106,25 @@ jobs: - name: Create Gitea release run: | + REGISTRY="${{ gitea.server_url }}" + REGISTRY="${REGISTRY#https://}" + REGISTRY="${REGISTRY#http://}" + IMAGE="$REGISTRY/$(echo '${{ gitea.repository }}' | tr '[:upper:]' '[:lower:]')" + + PREV_TAG=$(git tag --sort=-version:refname | { grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' || true; } | sed -n '2p') + if [ -n "$PREV_TAG" ]; then + CHANGELOG=$(git log --pretty=format:"- %s" "${PREV_TAG}..HEAD") + else + CHANGELOG=$(git log --pretty=format:"- %s") + fi + + BODY=$(printf '## Docker Image\n```\ndocker pull %s:%s\n```\n\n## Changelog\n%s' "$IMAGE" "$NEW_VERSION" "$CHANGELOG") + + jq -n --arg tag "$NEW_VERSION" --arg name "$NEW_VERSION" --arg body "$BODY" \ + '{tag_name: $tag, name: $name, body: $body}' > /tmp/release.json + curl -s -X POST \ -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ -H "Content-Type: application/json" \ "${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases" \ - -d "{\"tag_name\": \"$NEW_VERSION\", \"name\": \"$NEW_VERSION\", \"generate_release_notes\": true}" + -d @/tmp/release.json