From 137baaf19c8584926944fb2223f064a764087c33 Mon Sep 17 00:00:00 2001 From: Erik Date: Sun, 1 Mar 2026 13:36:27 +0100 Subject: [PATCH] =?UTF-8?q?.gitea/workflows/release.yaml=20hinzugef=C3=BCg?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/release.yaml | 65 +++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .gitea/workflows/release.yaml diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml new file mode 100644 index 0000000..045a432 --- /dev/null +++ b/.gitea/workflows/release.yaml @@ -0,0 +1,65 @@ +name: Automatisches Release mit ZIP-Archiv +on: + push: + tags: + - 'v*' + +jobs: + Build-Release: + runs-on: alpine-latest + defaults: + run: + shell: sh + + steps: + - name: Vorbereitung und Tools installieren + run: | + apk add --no-cache git zip curl jq + git config --global http.sslVerify false + + - name: Code auschecken (Über externe Domain) + run: | + git clone --depth 1 --branch ${{ github.ref_name }} https://x-access-token:${{ gitea.token }}@entwicklung.flurneuordnung-sachsen.de/${{ github.repository }}.git . + + - name: ZIP-Archiv erstellen + run: | + echo "Erstelle ZIP-Datei für Version ${{ github.ref_name }}..." + zip -r release_${{ github.ref_name }}.zip . -x "*.git*" + ls -la *.zip + + - name: Neues Release in Gitea anlegen + run: | + echo "Kommuniziere mit Gitea API über HTTPS..." + API_RESPONSE=$(curl -s -k -X POST "https://entwicklung.flurneuordnung-sachsen.de/api/v1/repos/${{ github.repository }}/releases" \ + -H "accept: application/json" \ + -H "Authorization: token ${{ gitea.token }}" \ + -H "Content-Type: application/json" \ + -d '{ + "body": "Dieses Release wurde automatisch vom Gitea Runner erstellt.", + "draft": false, + "name": "Version ${{ github.ref_name }}", + "prerelease": false, + "tag_name": "${{ github.ref_name }}" + }') + + RELEASE_ID=$(echo $API_RESPONSE | jq -r '.id') + + if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then + echo "Fehler beim Erstellen des Releases. API Antwort:" + echo $API_RESPONSE + exit 1 + fi + + echo "Release ID: $RELEASE_ID" + echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV + + - name: ZIP-Archiv an das Release anhängen + run: | + echo "Lade release_${{ github.ref_name }}.zip hoch..." + curl -s -k -X POST "https://entwicklung.flurneuordnung-sachsen.de/api/v1/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }}/assets?name=release_${{ github.ref_name }}.zip" \ + -H "accept: application/json" \ + -H "Authorization: token ${{ gitea.token }}" \ + -H "Content-Type: multipart/form-data" \ + -F "attachment=@release_${{ github.ref_name }}.zip" + + echo "✅ Upload abgeschlossen!" \ No newline at end of file