Add draft releases workflow.
This commit is contained in:
parent
b8d8b2f4a6
commit
6c46cc09bc
1 changed files with 42 additions and 0 deletions
42
.forgejo/workflows/release-notes.yml
Normal file
42
.forgejo/workflows/release-notes.yml
Normal 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
|
||||||
|
}'
|
||||||
Loading…
Add table
Add a link
Reference in a new issue