Files
demo/autopost.sh

57 lines
1.5 KiB
Bash
Raw Normal View History

#!/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
2025-05-29 14:30:31 +02:00
#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($random_string): Auto-Update Zufallsstring $random_string"
# git push
#done
TYPES=(chore docs feat fix refactor style test)
for type in "${TYPES[@]}"; do
for i in {1..3}; do
random_string=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 8)
2025-05-29 16:33:08 +02:00
echo "Zufallsstring $i für Typ '$type': $random_string #1"
2025-05-29 14:30:31 +02:00
echo "$random_string" >> "$README_FILE"
git add "$README_FILE"
git commit -m "$type($random_string): Auto-Update Zufallsstring $random_string"
git push
done
done
2025-05-29 14:30:31 +02:00
# Tag erstellen und pushen
git tag "$new_tag"
git push origin "$new_tag"
echo "Fertig! Neues semver-Tag erstellt: $new_tag"