Files
HailMaryGuildTools/.gitea/workflows/tag-from-toc.yml
Torsten Brendgen 340b9c63d0 init 2.0.0
2026-04-11 22:51:14 +02:00

66 lines
1.5 KiB
YAML

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 "Gefundene Version: $VERSION"
echo "Neues Tag wäre: $TAG"
echo "$TAG" > /tmp/release_tag.txt
- name: Tag nur erstellen, wenn noch nicht vorhanden
run: |
set -e
cd /tmp/repo
git fetch --tags
TAG=$(cat /tmp/release_tag.txt)
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"