feat(autopost): Script für autmatisierung
This commit is contained in:
41
autopost.sh
Executable file
41
autopost.sh
Executable file
@@ -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"
|
||||
Reference in New Issue
Block a user