Add draft releases workflow.
All checks were successful
Spell Check / Check spelling (push) Successful in 8s
vale / runner / vale (push) Successful in 4s

This commit is contained in:
g_it 2026-04-09 00:54:07 +02:00
commit 6c46cc09bc
Signed by untrusted user who does not match committer: g_it
GPG key ID: A2B0A7C06A054627

View file

@ -0,0 +1,42 @@
name: Create Draft Release Notes
on:
push:
tags:
- "v*"
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
run: |
git clone --depth 1 https://token:${{ secrets.ACTIONS_TOKEN }}@gugulet.hu/technical/git/g_it/site.git .
- name: Generate release notes
id: notes
run: |
CURRENT_TAG=$(git describe --tags --exact-match)
PREVIOUS_TAG=$(git tag --sort=-version:refname --list | awk "NR>1 {print; exit}")
if [ -z "$PREVIOUS_TAG" ]; then
CHANGELOG=$(git log --pretty=format:"- %s" --no-decorate)
else
CHANGELOG=$(git log ${PREVIOUS_TAG}..${CURRENT_TAG} --pretty=format:"- %s" --no-decorate)
fi
echo "changelog=$CHANGELOG" >> $GITHUB_OUTPUT
- name: Create release via Forgejo API
run: |
curl -X POST https://${{ gitea.server }}/api/v1/repos/${{ gitea.repository }}/releases \
-H "Authorization: token ${{ secrets.ACTIONS_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{
"tag_name": "${{ gitea.ref_name }}",
"name": "Release ${{ gitea.ref_name }}",
"body": "## Changes\n\n${{ steps.notes.outputs.changelog }}",
"draft": true,
"prerelease": false
}'