X: Update publishGitHub script

This commit is contained in:
2026-07-03 11:58:18 +02:00
parent 932b2589e4
commit 0931dbe99a
+21 -3
View File
@@ -1,9 +1,28 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <github-snapshot-branch>" >&2
exit 1
fi
BRANCH="$1"
SOURCE="$HOME/projects/com_r35157_nenjim-hubd-impl_ref" SOURCE="$HOME/projects/com_r35157_nenjim-hubd-impl_ref"
TARGET="$HOME/projects/com_r35157_nenjim-hubd-impl_ref_github_snapshot" TARGET="$HOME/projects/com_r35157_nenjim-hubd-impl_ref_github_snapshot"
cd "$TARGET"
git fetch origin
if git show-ref --verify --quiet "refs/heads/$BRANCH"; then
git switch "$BRANCH"
elif git show-ref --verify --quiet "refs/remotes/origin/$BRANCH"; then
git switch --track "origin/$BRANCH"
else
git switch --create "$BRANCH"
fi
rsync -a --delete \ rsync -a --delete \
--exclude '.git' \ --exclude '.git' \
--exclude 'conf/*.conf' \ --exclude 'conf/*.conf' \
@@ -11,13 +30,12 @@ rsync -a --delete \
"$SOURCE/" \ "$SOURCE/" \
"$TARGET/" "$TARGET/"
cd "$TARGET"
git add -A git add -A
if git diff --cached --quiet; then if git diff --cached --quiet; then
echo "No snapshot changes to publish." echo "No snapshot changes to publish on branch '$BRANCH'."
exit 0 exit 0
fi fi
git commit -m "Mirror snapshot" git commit -m "Mirror snapshot"
git push git push -u origin "$BRANCH"