From c32189e8aa4de89eb14a4e834ff2b7fb8fa75768 Mon Sep 17 00:00:00 2001 From: Robin Schanbacher Date: Sat, 25 Jul 2026 17:57:57 +0000 Subject: [PATCH] automaticly create release --- .gitea/workflows/deploy.yaml | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 3c686ac..39ad009 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -36,4 +36,33 @@ jobs: --name psalmtafel-container \ -p 8443:3000 \ --restart always \ - psalmtafel-app \ No newline at end of file + psalmtafel-app + - name: Release in Gitea erstellen + run: | + # 1. Version aus package.json auslesen + VERSION=$(node -p "require('./package.json').version") + echo "Aktuelle Version: v$VERSION" + + # 2. Prüfen, ob das Release/Tag bereits existiert + HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ + -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ + "http://172.17.0.1:3000/api/v1/repos/${{ github.repository }}/releases/tags/v$VERSION") + + # 3. Wenn Release noch nicht existiert (404), erstelle es + if [ "$HTTP_STATUS" -eq 404 ]; then + echo "Erstelle neues Release v$VERSION..." + curl -X POST \ + -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d "{ + \"tag_name\": \"v$VERSION\", + \"target_commitish\": \"main\", + \"name\": \"Release v$VERSION\", + \"body\": \"Automatisches Release für Version v$VERSION\", + \"draft\": false, + \"prerelease\": false + }" \ + "http://172.17.0.1:3000/api/v1/repos/${{ github.repository }}/releases" + else + echo "Release v$VERSION existiert bereits. Überspringe Erstellung." + fi \ No newline at end of file