Korrektur der Version- und Channel-Bestimmung für Suffixe

This commit is contained in:
Michael Otto
2026-03-13 09:59:19 +01:00
parent 541c210bf6
commit 46d23087e2

View File

@@ -4,7 +4,7 @@ run-name: "Release | ${{ github.ref_name }}"
on: on:
push: push:
tags: tags:
- '*' - 'v*'
jobs: jobs:
release: release:
@@ -41,28 +41,46 @@ jobs:
run: | run: |
TAG="${{ github.ref_name }}" TAG="${{ github.ref_name }}"
if [[ "$TAG" =~ ^v ]]; then case "$TAG" in
VERSION="${TAG#v}" *-unstable*)
CHANNEL="stable" VERSION="${TAG%-unstable}"
DRAFT="false" VERSION="${VERSION#v}"
PRERELEASE="false" CHANNEL="unstable"
elif [[ "$TAG" =~ ^t ]]; then DRAFT="false"
VERSION="${TAG#t}" PRERELEASE="true"
CHANNEL="testing" ;;
DRAFT="false" *-testing*)
PRERELEASE="true" VERSION="${TAG%-testing}"
elif [[ "$TAG" =~ ^u ]]; then VERSION="${VERSION#v}"
VERSION="${TAG#u}" CHANNEL="testing"
CHANNEL="unstable" DRAFT="false"
DRAFT="false" PRERELEASE="true"
PRERELEASE="true" ;;
else v*)
# Fallback für andere Prefixe, z.B. x26.3.1 -> 26.3.1-unstable VERSION="${TAG#v}"
VERSION="${TAG#?}" CHANNEL="stable"
CHANNEL="unstable" DRAFT="false"
DRAFT="false" PRERELEASE="false"
PRERELEASE="true" ;;
fi t*)
VERSION="${TAG#t}"
CHANNEL="testing"
DRAFT="false"
PRERELEASE="true"
;;
u*)
VERSION="${TAG#u}"
CHANNEL="unstable"
DRAFT="false"
PRERELEASE="true"
;;
*)
VERSION="${TAG#?}"
CHANNEL="unstable"
DRAFT="false"
PRERELEASE="true"
;;
esac
echo "version=$VERSION" >> $GITHUB_OUTPUT echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "channel=$CHANNEL" >> $GITHUB_OUTPUT echo "channel=$CHANNEL" >> $GITHUB_OUTPUT
@@ -175,15 +193,9 @@ jobs:
API_URL="https://${{ vars.RELEASE_URL }}/api/v1/repos/${GITHUB_REPOSITORY}/releases" API_URL="https://${{ vars.RELEASE_URL }}/api/v1/repos/${GITHUB_REPOSITORY}/releases"
if [[ "$CHANNEL" == "stable" ]]; then
RELEASE_NAME="$VERSION"
else
RELEASE_NAME="$VERSION-$CHANNEL"
fi
JSON=$(jq -n \ JSON=$(jq -n \
--arg tag "$TAG" \ --arg tag "$TAG" \
--arg name "$RELEASE_NAME" \ --arg name "Version $VERSION" \
--arg body "${{ steps.changelog.outputs.current }}" \ --arg body "${{ steps.changelog.outputs.current }}" \
--argjson draft "${{ steps.releaseinfo.outputs.draft }}" \ --argjson draft "${{ steps.releaseinfo.outputs.draft }}" \
--argjson prerelease "${{ steps.releaseinfo.outputs.prerelease }}" \ --argjson prerelease "${{ steps.releaseinfo.outputs.prerelease }}" \
@@ -296,4 +308,4 @@ jobs:
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "$JSON" \ -d "$JSON" \
"https://${{ vars.RELEASE_URL }}/api/v1/repos/${OWNER}/Repository/actions/workflows/${WORKFLOW}/dispatches" "https://${{ vars.RELEASE_URL }}/api/v1/repos/${OWNER}/Repository/actions/workflows/${WORKFLOW}/dispatches"