torsten-patch-1 #2
66
.gitea/workflows/tag-from-toc.yml
Normal file
66
.gitea/workflows/tag-from-toc.yml
Normal file
@@ -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}"
|
||||||
Reference in New Issue
Block a user