added release script for release repo

This commit is contained in:
2025-11-24 11:45:24 +01:00
parent 209e89a6e3
commit f88024e3e0

39
release_bot.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/bash
# release-to-gitea.sh
WORK_REMOTE="https://github.com/wwevo/chrani-bot-tng-mod.git"
GITEA_REMOTE="https://code.notjustfor.me/wwevo/chrani-bot-tng-mod.git"
RELEASE_TAG=$(grep -oP '(?<=<Version value=")[^"]+' ./CHRANIBotTNG/ModInfo.xml)
if [ -z "$RELEASE_TAG" ]; then
echo ".xml not found or wrong ModInfo version."
exit 1
fi
# Create temp directory
TEMP_DIR=$(mktemp -d)
cd "$TEMP_DIR"
# Clone from work remote
git clone "$WORK_REMOTE" release_repo
cd release_repo
# Squash all commits into one
git reset $(git commit-tree HEAD^{tree} -m "Release $RELEASE_TAG")
# Change author
git commit --amend --author="wwevo <code@notjustfor.me>" --no-edit
# Tag the release
git tag "$RELEASE_TAG"
# Push to Gitea
git remote add gitea "$GITEA_REMOTE"
git push gitea master --force
git push gitea "$RELEASE_TAG"
# Cleanup
cd ~
rm -rf "$TEMP_DIR"
echo "Release $RELEASE_TAG pushed to Gitea"