.gitea/workflows/release.yml aktualisiert
This commit is contained in:
@ -11,8 +11,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Enable debug output
|
- name: Enable debug output
|
||||||
run: |
|
run: set -x
|
||||||
set -x
|
|
||||||
|
|
||||||
- name: Checkout source
|
- name: Checkout source
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@ -45,33 +44,49 @@ jobs:
|
|||||||
- name: Show git-chglog version
|
- name: Show git-chglog version
|
||||||
run: git-chglog --version
|
run: git-chglog --version
|
||||||
|
|
||||||
- name: Generate CHANGELOG.md for current tag
|
- name: Determine previous tag
|
||||||
|
id: tags
|
||||||
run: |
|
run: |
|
||||||
TAG=${GITHUB_REF##*/} # z.B. v1.0.0
|
CURRENT_TAG="${GITHUB_REF##*/}"
|
||||||
echo "Generating changelog for tag: $TAG"
|
PREVIOUS_TAG=$(git tag --sort=-creatordate | grep -v "$CURRENT_TAG" | tail -n1 || true)
|
||||||
git-chglog -o CHANGELOG.md "$TAG"
|
|
||||||
echo "Changelog generated:"
|
echo "CURRENT_TAG=$CURRENT_TAG" >> $GITHUB_ENV
|
||||||
cat CHANGELOG.md
|
echo "PREVIOUS_TAG=$PREVIOUS_TAG" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Generate CHANGELOGs
|
||||||
|
run: |
|
||||||
|
# Vollständiger Changelog
|
||||||
|
git-chglog -o CHANGELOG.md
|
||||||
|
|
||||||
|
# Nur aktueller Abschnitt
|
||||||
|
if [ -n "$PREVIOUS_TAG" ]; then
|
||||||
|
git-chglog "$PREVIOUS_TAG..$CURRENT_TAG" > RELEASE_BODY.md
|
||||||
|
else
|
||||||
|
git-chglog "$CURRENT_TAG" > RELEASE_BODY.md
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Release changelog content:"
|
||||||
|
cat RELEASE_BODY.md
|
||||||
|
|
||||||
- name: Create Gitea Release via API (Markdown-safe)
|
- name: Create Gitea Release via API (Markdown-safe)
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.TOKEN }}
|
TOKEN: ${{ secrets.TOKEN }}
|
||||||
OWNER: ${{ env.OWNER }}
|
OWNER: ${{ env.OWNER }}
|
||||||
REPO: ${{ env.REPO }}
|
REPO: ${{ env.REPO }}
|
||||||
|
CURRENT_TAG: ${{ env.CURRENT_TAG }}
|
||||||
run: |
|
run: |
|
||||||
TAG=${GITHUB_REF##*/}
|
BODY=$(base64 -w0 RELEASE_BODY.md)
|
||||||
BODY=$(base64 -w0 CHANGELOG.md)
|
|
||||||
DECODED_BODY=$(echo "$BODY" | base64 -d | jq -Rs .)
|
DECODED_BODY=$(echo "$BODY" | base64 -d | jq -Rs .)
|
||||||
|
|
||||||
echo "Creating release for tag $TAG"
|
echo "Creating release for tag $CURRENT_TAG"
|
||||||
|
|
||||||
curl -X POST "https://dev.ksite.de/api/v1/repos/${OWNER}/${REPO}/releases" \
|
curl -s -X POST "https://dev.ksite.de/api/v1/repos/${OWNER}/${REPO}/releases" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "Authorization: token $TOKEN" \
|
-H "Authorization: token $TOKEN" \
|
||||||
-d @- <<EOF
|
-d @- <<EOF
|
||||||
{
|
{
|
||||||
"tag_name": "${TAG}",
|
"tag_name": "${CURRENT_TAG}",
|
||||||
"name": "${TAG}",
|
"name": "${CURRENT_TAG}",
|
||||||
"body": ${DECODED_BODY}
|
"body": ${DECODED_BODY}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
Reference in New Issue
Block a user