diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 81a3c86..dae05f6 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -4,7 +4,7 @@ run-name: "Release | ${{ github.ref_name }}" on: push: tags: - - '*' + - 'v*' jobs: release: @@ -41,28 +41,46 @@ jobs: run: | TAG="${{ github.ref_name }}" - if [[ "$TAG" =~ ^v ]]; then - VERSION="${TAG#v}" - CHANNEL="stable" - DRAFT="false" - PRERELEASE="false" - elif [[ "$TAG" =~ ^t ]]; then - VERSION="${TAG#t}" - CHANNEL="testing" - DRAFT="false" - PRERELEASE="true" - elif [[ "$TAG" =~ ^u ]]; then - VERSION="${TAG#u}" - CHANNEL="unstable" - DRAFT="false" - PRERELEASE="true" - else - # Fallback für andere Prefixe, z.B. x26.3.1 -> 26.3.1-unstable - VERSION="${TAG#?}" - CHANNEL="unstable" - DRAFT="false" - PRERELEASE="true" - fi + case "$TAG" in + *-unstable*) + VERSION="${TAG%-unstable}" + VERSION="${VERSION#v}" + CHANNEL="unstable" + DRAFT="false" + PRERELEASE="true" + ;; + *-testing*) + VERSION="${TAG%-testing}" + VERSION="${VERSION#v}" + CHANNEL="testing" + DRAFT="false" + PRERELEASE="true" + ;; + v*) + VERSION="${TAG#v}" + CHANNEL="stable" + DRAFT="false" + PRERELEASE="false" + ;; + 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 "channel=$CHANNEL" >> $GITHUB_OUTPUT @@ -175,15 +193,9 @@ jobs: 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 \ --arg tag "$TAG" \ - --arg name "$RELEASE_NAME" \ + --arg name "Version $VERSION" \ --arg body "${{ steps.changelog.outputs.current }}" \ --argjson draft "${{ steps.releaseinfo.outputs.draft }}" \ --argjson prerelease "${{ steps.releaseinfo.outputs.prerelease }}" \ @@ -296,4 +308,4 @@ jobs: -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ -H "Content-Type: application/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" \ No newline at end of file