Files
Dockhand_Backup/.gitea/workflows/create-release.yml
TDPI 8d0db9beba
All checks were successful
Create Release PR / Create Release PR (push) Successful in 20s
feat: first release
2026-07-13 13:31:51 +02:00

63 lines
2.2 KiB
YAML

name: Create Release
on:
pull_request:
types: [closed]
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
publish-release:
name: Publish Release
if: gitea.event_name == 'pull_request' && gitea.event.pull_request.merged == true && startsWith(gitea.event.pull_request.head.ref, 'release-please')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GT_TOKEN }}
- name: Get version
id: version
run: |
VERSION=$(jq -r '."."' .release-please-manifest.json)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Create Git Tag
env:
GIT_TOKEN: ${{ secrets.GT_TOKEN }}
run: |
git config user.name "Gitea Actions"
git config user.email "actions@git.tdpi.dev"
git tag -a "v${{ steps.version.outputs.version }}" -m "Release v${{ steps.version.outputs.version }}"
git push https://x-access-token:${GIT_TOKEN}@git.tdpi.dev/TDPI/Dockhand_Backup.git "v${{ steps.version.outputs.version }}"
- name: Create Release
env:
GIT_TOKEN: ${{ secrets.GT_TOKEN }}
VERSION: ${{ steps.version.outputs.version }}
run: |
# Changelog direkt aus der Datei lesen (vermeidet Quoting-Probleme bei Output-Substitution)
CHANGELOG=$(awk '/^## '"$VERSION"'/{flag=1} /^## / && flag && !/^## '"$VERSION"'/{exit} flag' CHANGELOG.md)
# Erstellt die JSON-Payload sicher mit jq
PAYLOAD=$(jq -n \
--arg tag "v$VERSION" \
--arg name "v$VERSION" \
--arg body "$CHANGELOG" \
'{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: false}')
# Führt den Curl-Befehl mit der sicheren Payload aus
curl -X POST "https://git.tdpi.dev/api/v1/repos/TDPI/Dockhand_Backup/releases" \
-H "Authorization: token $GIT_TOKEN" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"
- name: Cleanup Release Branch
env:
GIT_TOKEN: ${{ secrets.GT_TOKEN }}
run: |
git push --delete origin release-please--branches--main