From 4e8536ec511dd5a42180a5f76b9a05cad2813e54 Mon Sep 17 00:00:00 2001 From: Torsten Date: Sat, 11 Apr 2026 20:37:59 +0000 Subject: [PATCH 1/4] =?UTF-8?q?.gitea/workflows/tag-from-toc.yml=20hinzuge?= =?UTF-8?q?f=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/tag-from-toc.yml | 66 +++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .gitea/workflows/tag-from-toc.yml diff --git a/.gitea/workflows/tag-from-toc.yml b/.gitea/workflows/tag-from-toc.yml new file mode 100644 index 0000000..9833cd0 --- /dev/null +++ b/.gitea/workflows/tag-from-toc.yml @@ -0,0 +1,66 @@ +name: Tag from TOC Version + +on: + push: + branches: + - main + +jobs: + tag: + runs-on: debian-12 + + steps: + - name: Tools installieren + run: | + apt-get update + apt-get install -y git grep sed + + - name: Repo klonen + run: | + rm -rf /tmp/repo + git clone http://oauth2:${{ secrets.PAT_TOKEN }}@10.10.2.140:3000/Torsten/HailMaryGuildTools.git /tmp/repo + + - name: Version aus TOC lesen + run: | + set -e + cd /tmp/repo + + TOC_FILE="HailMaryGuildTools.toc" + + if [ ! -f "$TOC_FILE" ]; then + echo "TOC-Datei nicht gefunden: $TOC_FILE" + exit 1 + fi + + VERSION=$(grep '^## Version:' "$TOC_FILE" | sed 's/^## Version:[[:space:]]*//') + + if [ -z "$VERSION" ]; then + echo "Keine Version in $TOC_FILE gefunden" + exit 1 + fi + + TAG="v$VERSION" + + echo "VERSION=$VERSION" >> "$GITHUB_ENV" + echo "TAG=$TAG" >> "$GITHUB_ENV" + + echo "Gefundene Version: $VERSION" + echo "Neues Tag wäre: $TAG" + + - name: Tag nur erstellen, wenn noch nicht vorhanden + run: | + set -e + cd /tmp/repo + + git fetch --tags + + if git rev-parse "${TAG}" >/dev/null 2>&1; then + echo "Tag ${TAG} existiert bereits, nichts zu tun." + exit 0 + fi + + git config user.name "Gitea Actions" + git config user.email "actions@local" + + git tag "${TAG}" + git push origin "${TAG}" \ No newline at end of file -- 2.39.5 From 5721ed749679ffb13098951484bef72cb1e11a11 Mon Sep 17 00:00:00 2001 From: Torsten Date: Sat, 11 Apr 2026 20:38:25 +0000 Subject: [PATCH 2/4] =?UTF-8?q?.gitea/workflows/tag-on-main.yml=20gel?= =?UTF-8?q?=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/tag-on-main.yml | 51 -------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 .gitea/workflows/tag-on-main.yml diff --git a/.gitea/workflows/tag-on-main.yml b/.gitea/workflows/tag-on-main.yml deleted file mode 100644 index a01a45a..0000000 --- a/.gitea/workflows/tag-on-main.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Auto Tag on Main - -on: - push: - branches: - - main - -jobs: - tag: - runs-on: debian-12 - - steps: - - name: Tools installieren - run: | - apt-get update - apt-get install -y git - - - name: Repo klonen - run: | - rm -rf /tmp/repo - git clone http://oauth2:${{ secrets.PAT_TOKEN }}@10.10.2.140:3000/Torsten/HailMaryGuildTools.git /tmp/repo - - - name: Nächstes Patch-Tag berechnen und pushen - run: | - set -e - cd /tmp/repo - - git fetch --tags - - LAST_TAG=$(git tag -l 'v*' --sort=-version:refname | head -n 1) - - if [ -z "$LAST_TAG" ]; then - NEW_TAG="v1.0.0" - else - VERSION="${LAST_TAG#v}" - MAJOR=$(echo "$VERSION" | cut -d. -f1) - MINOR=$(echo "$VERSION" | cut -d. -f2) - PATCH=$(echo "$VERSION" | cut -d. -f3) - - PATCH=$((PATCH + 1)) - NEW_TAG="v${MAJOR}.${MINOR}.${PATCH}" - fi - - echo "Letzter Tag: ${LAST_TAG:-keiner}" - echo "Neuer Tag: $NEW_TAG" - - git config user.name "Gitea Actions" - git config user.email "actions@local" - - git tag "$NEW_TAG" - git push origin "$NEW_TAG" \ No newline at end of file -- 2.39.5 From 73f662c546392bb425f2cf4e8ac1b66a3609ffd3 Mon Sep 17 00:00:00 2001 From: Torsten Date: Sat, 11 Apr 2026 20:38:43 +0000 Subject: [PATCH 3/4] =?UTF-8?q?.gitea/workflows/release.yml=20gel=C3=B6sch?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/release.yml | 65 ------------------------------------ 1 file changed, 65 deletions(-) delete mode 100644 .gitea/workflows/release.yml diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml deleted file mode 100644 index 3a699b5..0000000 --- a/.gitea/workflows/release.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Build Release ZIP - -on: - push: - tags: - - "v*" - -jobs: - release: - runs-on: debian-12 - - steps: - - name: Tools installieren - run: | - apt-get update - apt-get install -y git zip curl jq - - - name: Repo klonen - run: | - rm -rf /tmp/repo /tmp/build - git clone http://oauth2:${{ secrets.PAT_TOKEN }}@10.10.2.140:3000/Torsten/HailMaryGuildTools.git /tmp/repo - - - name: ZIP bauen mit Addon-Ordner - run: | - mkdir -p /tmp/build/HailMaryGuildTools - cp -r /tmp/repo/* /tmp/build/HailMaryGuildTools/ - cd /tmp/build - zip -r /tmp/HailMaryGuildTools-${{ gitea.ref_name }}.zip HailMaryGuildTools - ls -lh /tmp/HailMaryGuildTools-${{ gitea.ref_name }}.zip - - - name: Release anlegen oder laden - run: | - TAG="${{ gitea.ref_name }}" - API="http://10.10.2.140:3000/api/v1/repos/Torsten/HailMaryGuildTools" - - HTTP_CODE=$(curl -s -o /tmp/release.json -w "%{http_code}" \ - -H "Authorization: token ${{ secrets.PAT_TOKEN }}" \ - "$API/releases/tags/$TAG") - - if [ "$HTTP_CODE" = "200" ]; then - echo "Release existiert bereits" - else - curl --fail -s \ - -H "Authorization: token ${{ secrets.PAT_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d "{ - \"tag_name\": \"$TAG\", - \"name\": \"HailMaryGuildTools $TAG\", - \"draft\": false, - \"prerelease\": false - }" \ - "$API/releases" > /tmp/release.json - fi - - jq '.id, .tag_name, .html_url' /tmp/release.json - - - name: ZIP an Release anhängen - run: | - RELEASE_ID=$(jq -r '.id' /tmp/release.json) - FILE="/tmp/HailMaryGuildTools-${{ gitea.ref_name }}.zip" - - curl --fail \ - -H "Authorization: token ${{ secrets.PAT_TOKEN }}" \ - -F "attachment=@${FILE}" \ - "http://10.10.2.140:3000/api/v1/repos/Torsten/HailMaryGuildTools/releases/${RELEASE_ID}/assets?name=$(basename "$FILE")" \ No newline at end of file -- 2.39.5 From d00e29f99eaed8272fe2f000cd2b53c29f0059b2 Mon Sep 17 00:00:00 2001 From: Torsten Date: Sat, 11 Apr 2026 20:39:03 +0000 Subject: [PATCH 4/4] =?UTF-8?q?.gitea/workflows/release-from-tag=20hinzuge?= =?UTF-8?q?f=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/release-from-tag | 74 +++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .gitea/workflows/release-from-tag diff --git a/.gitea/workflows/release-from-tag b/.gitea/workflows/release-from-tag new file mode 100644 index 0000000..f403c9e --- /dev/null +++ b/.gitea/workflows/release-from-tag @@ -0,0 +1,74 @@ +name: Build Release ZIP + +on: + push: + tags: + - "v*" + +jobs: + release: + runs-on: debian-12 + + steps: + - name: Tools installieren + run: | + apt-get update + apt-get install -y git zip curl jq rsync + + - name: Repo klonen + run: | + rm -rf /tmp/repo /tmp/build + git clone http://oauth2:${{ secrets.PAT_TOKEN }}@10.10.2.140:3000/Torsten/HailMaryGuildTools.git /tmp/repo + + - name: ZIP mit Addon-Ordner bauen + run: | + set -e + mkdir -p /tmp/build/HailMaryGuildTools + + rsync -a \ + --exclude='.git' \ + --exclude='.gitea' \ + /tmp/repo/ /tmp/build/HailMaryGuildTools/ + + cd /tmp/build + zip -r "/tmp/HailMaryGuildTools-${{ gitea.ref_name }}.zip" HailMaryGuildTools + ls -lh "/tmp/HailMaryGuildTools-${{ gitea.ref_name }}.zip" + + - name: Release anlegen oder vorhandene laden + run: | + set -e + TAG="${{ gitea.ref_name }}" + API="http://10.10.2.140:3000/api/v1/repos/Torsten/HailMaryGuildTools" + + HTTP_CODE=$(curl -s -o /tmp/release.json -w "%{http_code}" \ + -H "Authorization: token ${{ secrets.PAT_TOKEN }}" \ + "$API/releases/tags/$TAG") + + if [ "$HTTP_CODE" = "200" ]; then + echo "Release existiert bereits." + else + echo "Release wird erstellt." + curl --fail -s \ + -H "Authorization: token ${{ secrets.PAT_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d "{ + \"tag_name\": \"$TAG\", + \"name\": \"HailMaryGuildTools $TAG\", + \"draft\": false, + \"prerelease\": false + }" \ + "$API/releases" > /tmp/release.json + fi + + jq '.id, .tag_name, .html_url' /tmp/release.json + + - name: ZIP an Release anhängen + run: | + set -e + RELEASE_ID=$(jq -r '.id' /tmp/release.json) + FILE="/tmp/HailMaryGuildTools-${{ gitea.ref_name }}.zip" + + curl --fail \ + -H "Authorization: token ${{ secrets.PAT_TOKEN }}" \ + -F "attachment=@${FILE}" \ + "http://10.10.2.140:3000/api/v1/repos/Torsten/HailMaryGuildTools/releases/${RELEASE_ID}/assets?name=$(basename "$FILE")" \ No newline at end of file -- 2.39.5