iptv-gh-pages/sync.sh
2026-07-05 23:32:52 +08:00

40 lines
682 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -e
echo "[1] update iptv-org repo"
if [ ! -d iptv ]; then
git clone https://github.com/iptv-org/iptv.git
fi
cd iptv
git fetch origin
git checkout gh-pages
git reset --hard origin/gh-pages
cd ..
echo "[2] update gitea repo"
if [ ! -d iptv-gh-pages ]; then
git clone https://${GITEA_HOST}/${GITEA_REPO}.git iptv-gh-pages
fi
cd iptv-gh-pages
git pull origin main || true
echo "[3] sync files"
# 清空旧内容(保留 .git
find . -mindepth 1 -maxdepth 1 ! -name ".git" -exec rm -rf {} +
cp -r ../iptv/* .
echo "[4] commit & push"
git add .
git commit -m "sync: $(date '+%Y-%m-%d %H:%M:%S')" || echo "no changes"
git push origin main
echo "[done]"