From 071bd70a72728c2237459982f3ad7c077abd01fa Mon Sep 17 00:00:00 2001 From: DragonSlayer_14 Date: Sun, 23 Aug 2026 12:56:33 +0200 Subject: [PATCH] =?UTF-8?q?Feat:=20F=C3=BCgt=20Erstellung=20von=20Preview-?= =?UTF-8?q?Release=20und=20Upload=20von=20Assets=20im=20Dev-Workflow=20hin?= =?UTF-8?q?zu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/dev.yml | 78 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/dev.yml b/.gitea/workflows/dev.yml index 13c26e4..4b6cf2b 100644 --- a/.gitea/workflows/dev.yml +++ b/.gitea/workflows/dev.yml @@ -1,4 +1,4 @@ -name: Dev Build & Publish +name: Dev Build, Publish & Preview Release on: push: @@ -7,7 +7,7 @@ on: jobs: build-and-publish: - name: Build and Publish Packages (Testing) + name: Build, Publish Packages (Testing) & Create Preview Release runs-on: ubuntu-latest steps: - name: Checkout Repository @@ -75,3 +75,77 @@ jobs: --upload-file "$pkg" \ "${GITEA_URL}/api/packages/${REPO_OWNER}/arch/testing/upload" done + + - name: Create Gitea Preview Release and Upload Assets + env: + GITEA_URL: ${{ gitea.server_url || github.server_url }} + REPO: ${{ gitea.repository || github.repository }} + TOKEN: ${{ secrets.GITEA_TOKEN || secrets.GITHUB_TOKEN || github.token }} + run: | + VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" + TAG_NAME="v${VERSION}-preview" + RELEASE_TITLE="Preview Release ${TAG_NAME}" + RELEASE_NOTES="Automatisches Preview-Release für docker-update ${VERSION} (Branch: dev)." + + echo "Erstelle oder hole Preview-Release für Tag ${TAG_NAME} in ${REPO}..." + + GET_RESP=$(curl -s -w "\n%{http_code}" \ + -H "Authorization: token ${TOKEN}" \ + "${GITEA_URL}/api/v1/repos/${REPO}/releases/tags/${TAG_NAME}") + HTTP_CODE=$(echo "$GET_RESP" | tail -n1) + BODY=$(echo "$GET_RESP" | sed '$d') + + RELEASE_ID="" + if [ "$HTTP_CODE" -eq 200 ]; then + RELEASE_ID=$(echo "$BODY" | grep -o '"id":[0-9]*' | head -n1 | cut -d: -f2) + echo "Bestehendes Release gefunden (ID: ${RELEASE_ID})." + else + echo "Erstelle neues Preview-Release ${TAG_NAME}..." + CREATE_PAYLOAD=$(cat <