Skip to content

抓取並上傳 RSS #53266

抓取並上傳 RSS

抓取並上傳 RSS #53266

Workflow file for this run

name: 抓取並上傳 RSS
on:
workflow_dispatch:
push:
branches:
- main
paths:
- '.github/workflows/*'
- 'code/*'
# - '*.rss'
- '*'
- '**'
schedule:
- cron: '*/5 * * * *' # 每隔 5 分鐘運行一次
# - cron: '*/10 * * * *' # 每隔 10 分鐘運行一次
# - cron: '*/15 * * * *' # 每隔 15 分鐘運行一次
# - cron: '*/20 * * * *' # 每隔 20 分鐘運行一次
# - cron: '*/25 * * * *' # 每隔 25 分鐘運行一次
# - cron: '*/30 * * * *' # 每隔 30 分鐘運行一次
- cron: '0,5,10,15,20,25,30,35,40,45,50,55 * * * *' # 每 5 分鐘
jobs:
deploy:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: 檢出代碼
timeout-minutes: 2
uses: actions/checkout@v4
- name: 檢出代碼 2
timeout-minutes: 2
run: |
echo 1
for i in {1..100}; do git pull && break; done
echo 2
- name: Install and configure Cloudflare WARP
timeout-minutes: 2
run: |
echo 1
for i in {1..10}; do curl -v https://1.1.1.1/cdn-cgi/trace && break; done
echo 2
for i in {1..10}; do curl https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg && break; done
echo 3
for i in {1..10}; do echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list && break; done
echo 4
for i in {1..10}; do sudo apt update -y && break; done
echo 5
for i in {1..10}; do sudo apt install -y cloudflare-warp && break; done
echo 6
for i in {1..10}; do warp-cli --accept-tos registration new && break; done
echo 7
for i in {1..10}; do warp-cli --accept-tos mode warp+doh && break; done
echo 8
for i in {1..10}; do warp-cli --accept-tos tunnel ip add 127.0.0.1 && break; done
echo 9
for i in {1..10}; do warp-cli --accept-tos tunnel host add localhost && break; done
echo 10
for i in {1..10}; do warp-cli --accept-tos connect && break; done
echo 11
- name: Testing WARP
timeout-minutes: 2
run: |
echo 1
while ! curl -s https://1.1.1.1/cdn-cgi/trace | grep -q "warp=on"; do echo "warp is off, retrying..."; sleep 1; done; echo "warp is on"
echo 2
while ! curl -s https://mozilla.cloudflare-dns.com/cdn-cgi/trace | grep -q "warp=on"; do echo "warp is off, retrying..."; sleep 1; done; echo "warp is on"
echo 3
warp-cli --accept-tos tunnel stats
echo 4
warp-cli --accept-tos --help
echo 5
warp-cli --accept-tos settings | grep protocol
echo 6
warp-cli --accept-tos settings
echo 7
warp-cli --accept-tos tunnel protocol set MASQUE
echo 8
warp-cli --accept-tos settings | grep protocol
echo 9
for i in {1..10}; do curl -s curl -v https://images.weserv.nl/quota && break; done
echo 10
for i in {1..10}; do curl -s curl -v https://wsrv.nl/quota && break; done
echo 11
for i in {1..10}; do curl -s https://github.com/raileo98/test2/raw/refs/heads/main/hk_rthk_ch.xml | head -n 10 && break; done
echo 12
for i in {1..10}; do curl -s https://raw.githubusercontent.com/raileo98/test2/refs/heads/main/hk_rthk_ch.xml | head -n 10 && break; done
echo 13
- name: 檢出代碼 3
timeout-minutes: 2
run: |
echo 1
for i in {1..100}; do git pull && break; done
echo 2
- name: 安裝依賴
timeout-minutes: 2
run: |
for i in {1..10}; do sudo apt update -y && break; done
for i in {1..10}; do sudo apt install python3 python3-pip redis-server -y && break; done
for i in {1..10}; do sudo python3 -m pip install --upgrade -r requirements.txt && break; done
for i in {1..10}; do sudo systemctl status redis && break; done
for i in {1..10}; do sudo systemctl enable redis && break; done
for i in {1..10}; do sudo systemctl start redis && break; done
for i in {1..10}; do sudo systemctl status redis && break; done
- name: 執行 Python 腳本
timeout-minutes: 10
run: |
echo 1
python3 code/rthk.py
echo 2
- name: Redis 狀態
run: |
for i in {1..10}; do sudo systemctl status redis && break; done
- name: 上傳 RSS 文件
run: |
git config --global user.email "github-actions@github.com"
git config --global user.name "github-actions"
git add *.xml
echo '# git stash'
git commit -m "Upload RSS file"
git push origin main