diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index be9c6ea..639f07d 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -32,11 +32,15 @@ jobs: run: | DECODED=$(echo "${{ github.event.inputs.payload }}" | base64 -d) + echo "name=$(echo "$DECODED" | jq -r '.name')" >> $GITHUB_OUTPUT + echo "group=$(echo "$DECODED" | jq -r '.group')" >> $GITHUB_OUTPUT echo "version=$(echo "$DECODED" | jq -r '.version')" >> $GITHUB_OUTPUT echo "channel=$(echo "$DECODED" | jq -r '.channel')" >> $GITHUB_OUTPUT echo "prerelease=$(echo "$DECODED" | jq -r '.prerelease')" >> $GITHUB_OUTPUT echo "zip_folder=$(echo "$DECODED" | jq -r '.zip_folder')" >> $GITHUB_OUTPUT + echo "name=$(echo "$DECODED" | jq -r '.name')" + echo "group=$(echo "$DECODED" | jq -r '.group')" echo "version=$(echo "$DECODED" | jq -r '.version')" echo "channel=$(echo "$DECODED" | jq -r '.channel')" echo "prerelease=$(echo "$DECODED" | jq -r '.prerelease')" @@ -46,7 +50,7 @@ jobs: echo "git_repo_url=$GIT_REPO_URL" >> $GITHUB_OUTPUT echo "git_repo_url=$GIT_REPO_URL" - PAYLOAD_REPO=$(echo "$DECODED" | jq -r '.git_url') + PAYLOAD_REPO="${GROUP}/${NAME}" GIT_PLUGIN_URL="https://${RELEASE_TOKEN}:x-oauth-basic@${{ vars.RELEASE_URL }}/$PAYLOAD_REPO.git" echo "git_plugin_url=$GIT_PLUGIN_URL" >> $GITHUB_OUTPUT echo "git_plugin_url=$GIT_PLUGIN_URL" @@ -110,4 +114,50 @@ jobs: env: ZIP_FOLDER: ${{ steps.daten.outputs.zip_folder }} - ZIP_FILE: ${{ steps.daten.outputs.zip_folder }}.zip \ No newline at end of file + ZIP_FILE: ${{ steps.daten.outputs.zip_folder }}.zip + + - name: Changelog einlesen + id: changelog + run: | + cd plugin + + # Aktueller Block = alles vor dem ersten --- + CURRENT=$(awk '/^---/{exit} {print}' changelog.txt) + + # Vollständige Historie = alles nach dem ersten --- + HISTORY=$(awk 'found{print} /^---/{found=1}' changelog.txt) + + # Gitea Release Body zusammenbauen + VERSION="${{ steps.releaseinfo.outputs.version }}" + FULL=$(printf "## %s\n%s\n\n%s" "$VERSION" "$CURRENT" "$HISTORY") + + echo "DEBUG | Aktueller Changelog:" + echo "$CURRENT" + + # Für GITHUB_OUTPUT: Multiline via EOF-Marker + echo "current<> $GITHUB_OUTPUT + echo "$CURRENT" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + echo "full<> $GITHUB_OUTPUT + echo "$FULL" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Gitea-Release erstellen + id: create_release + run: | + API_URL="https://${{ vars.RELEASE_URL }}/api/v1/repos/${PLUGIN_GROUP}/${PLUGIN_NAME}/releases" + + JSON=$(jq -n \ + --arg tag "$TAG" \ + --arg name "Version $VERSION" \ + --arg body "${{ steps.changelog.outputs.current }}" \ + --argjson draft "${{ steps.releaseinfo.outputs.draft }}" \ + --argjson prerelease "${{ steps.releaseinfo.outputs.prerelease }}" \ + '{tag_name: $tag, name: $name, body: $body, draft: $draft, prerelease: $prerelease}') + + + env: + PLUGIN_NAME: ${{ steps.daten.outputs.name }} + PLUGIN_GROUP: ${{ steps.daten.outputs.group }} + RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} \ No newline at end of file