Files
HailMaryGuildTools/.gitea/workflows/tag-on-main.yml
2026-04-11 22:25:16 +02:00

51 lines
1.2 KiB
YAML

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"