.gitea/workflows/release.yml aktualisiert
This commit is contained in:
@ -3,7 +3,7 @@ name: Create Release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*' # Nur bei Tags wie v1.0.0
|
||||
- 'v*' # Nur bei Tags wie v1.0.0, v2.0.0
|
||||
|
||||
jobs:
|
||||
release:
|
||||
@ -13,8 +13,11 @@ jobs:
|
||||
- name: Enable debug output
|
||||
run: set -x
|
||||
|
||||
- name: Checkout source
|
||||
- name: Checkout full history including tags
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Show environment variables for debugging
|
||||
run: |
|
||||
@ -25,11 +28,8 @@ jobs:
|
||||
id: repo-info
|
||||
run: |
|
||||
REMOTE_URL=$(git config --get remote.origin.url)
|
||||
echo "Remote URL: $REMOTE_URL"
|
||||
|
||||
OWNER=$(echo "$REMOTE_URL" | sed -E 's#.*/([^/]+)/([^/]+)(\.git)?#\1#')
|
||||
REPO=$(echo "$REMOTE_URL" | sed -E 's#.*/([^/]+)/([^/]+)(\.git)?#\2#')
|
||||
|
||||
echo "OWNER=$OWNER" >> $GITHUB_ENV
|
||||
echo "REPO=$REPO" >> $GITHUB_ENV
|
||||
|
||||
@ -41,25 +41,11 @@ jobs:
|
||||
chmod +x git-chglog
|
||||
sudo mv git-chglog /usr/local/bin/
|
||||
|
||||
- name: Show git-chglog version
|
||||
run: git-chglog --version
|
||||
|
||||
- name: Determine previous tag
|
||||
- name: Determine current and previous tag
|
||||
id: tags
|
||||
run: |
|
||||
CURRENT_TAG="${GITHUB_REF##*/}"
|
||||
|
||||
# Vorherigen Tag in chronologischer Reihenfolge finden (älterer Tag direkt vor CURRENT_TAG)
|
||||
TAGS=($(git tag --sort=-creatordate))
|
||||
PREVIOUS_TAG=""
|
||||
|
||||
for tag in "${TAGS[@]}"; do
|
||||
if [ "$tag" = "$CURRENT_TAG" ]; then
|
||||
continue
|
||||
fi
|
||||
PREVIOUS_TAG="$tag"
|
||||
break
|
||||
done
|
||||
PREVIOUS_TAG=$(git describe --tags --abbrev=0 "${CURRENT_TAG}^" 2>/dev/null || true)
|
||||
|
||||
echo "CURRENT_TAG=$CURRENT_TAG"
|
||||
echo "PREVIOUS_TAG=$PREVIOUS_TAG"
|
||||
@ -67,13 +53,12 @@ jobs:
|
||||
echo "CURRENT_TAG=$CURRENT_TAG" >> $GITHUB_ENV
|
||||
echo "PREVIOUS_TAG=$PREVIOUS_TAG" >> $GITHUB_ENV
|
||||
|
||||
|
||||
- name: Generate CHANGELOGs
|
||||
- name: Generate CHANGELOG.md
|
||||
run: |
|
||||
# Vollständiger Changelog
|
||||
# Optional: kompletter Changelog (nicht für Release-Body)
|
||||
git-chglog -o CHANGELOG.md
|
||||
|
||||
# Nur aktueller Abschnitt
|
||||
# Nur der relevante Abschnitt zwischen Tags
|
||||
if [ -n "$PREVIOUS_TAG" ]; then
|
||||
git-chglog "$PREVIOUS_TAG..$CURRENT_TAG" > RELEASE_BODY.md
|
||||
else
|
||||
@ -83,13 +68,14 @@ jobs:
|
||||
echo "Release changelog content:"
|
||||
cat RELEASE_BODY.md
|
||||
|
||||
- name: Create Gitea Release via API (Markdown-safe)
|
||||
- name: Create Gitea Release via API
|
||||
env:
|
||||
TOKEN: ${{ secrets.TOKEN }}
|
||||
OWNER: ${{ env.OWNER }}
|
||||
REPO: ${{ env.REPO }}
|
||||
CURRENT_TAG: ${{ env.CURRENT_TAG }}
|
||||
run: |
|
||||
# Base64-encode und sicher escapen für JSON
|
||||
BODY=$(base64 -w0 RELEASE_BODY.md)
|
||||
DECODED_BODY=$(echo "$BODY" | base64 -d | jq -Rs .)
|
||||
|
||||
|
Reference in New Issue
Block a user