40 lines
682 B
Bash
40 lines
682 B
Bash
#!/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]" |