From 87b55486909a41adf000f2fc7cb7e19dcb9f5db4 Mon Sep 17 00:00:00 2001 From: Ralf Kirchner Date: Thu, 29 May 2025 13:40:03 +0200 Subject: [PATCH] =?UTF-8?q?feat(autopost):=20Script=20f=C3=BCr=20autmatisi?= =?UTF-8?q?erung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autopost.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 autopost.sh diff --git a/autopost.sh b/autopost.sh new file mode 100755 index 0000000..d46cc13 --- /dev/null +++ b/autopost.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +set -e + +# Sicherstellen, dass wir uns in einem Git-Repo befinden +if ! git rev-parse --is-inside-work-tree &>/dev/null; then + echo "Dieses Skript muss in einem Git-Repository ausgeführt werden." + exit 1 +fi + +README_FILE="README.md" + +# Aktuelles höchstes semver-Tag im Format vX.Y.Z finden +latest_tag=$(git tag | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n 1) + +if [[ $latest_tag =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then + major=${BASH_REMATCH[1]} + # Version erhöhen (nur Major erhöhen, Minor & Patch = 0) + new_major=$((major + 1)) +else + new_major=1 +fi + +new_tag="v${new_major}.0.0" + +# Drei zufällige Änderungen durchführen +for i in {1..3}; do + random_string=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 8) + echo "Zufallsstring $i: $random_string" + echo "$random_string" >> "$README_FILE" + + git add "$README_FILE" + git commit -m "feat($i):Auto-Update $i: Zufallsstring $random_string" + git push +done + +# Tag erstellen und pushen +git tag "$new_tag" +git push origin "$new_tag" + +echo "Fertig! Neues semver-Tag erstellt: $new_tag"