From 4e8536ec511dd5a42180a5f76b9a05cad2813e54 Mon Sep 17 00:00:00 2001 From: Torsten Date: Sat, 11 Apr 2026 20:37:59 +0000 Subject: [PATCH] =?UTF-8?q?.gitea/workflows/tag-from-toc.yml=20hinzugef?= =?UTF-8?q?=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