Update live.yml

This commit is contained in:
alantang 2025-04-11 14:26:01 +08:00 committed by GitHub
parent 0a11b347a3
commit 5a7abd43d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,12 +16,12 @@ jobs:
steps:
- name: 检出仓库
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: 设置Python环境
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.10'
- name: 安装依赖
run: |
@ -33,27 +33,19 @@ jobs:
- name: 检查文件是否生成
run: |
if [ -f "live.m3u" ]; then
echo "文件已生成"
if [ -f "live/live.m3u" ]; then
echo "live.m3u 文件已生成"
else
echo "文件未生成"
echo "live.m3u 文件未生成"
exit 1
fi
if [ -f "live.txt" ]; then
if [ -f "live/live.txt" ]; then
echo "live.txt 文件已生成"
else
echo "live.txt 文件未生成"
exit 1
fi
# 使用 curl 下载内容,并在第 1 到第 3 行插入指定说明文字
- name: Insert lines on line 1 和 2 和 3
run: |
DATE=$(date +"%m/%d")
sed -i '1i #EXTM3U x-tvg-url="https://epg.v1.mk/fy.xml"' live.m3u
sed -i '2i #EXTINF:-1 tvg-logo="https://codeberg.org/alantang/photo/raw/branch/main/photo_2025-03-16_10-57-18.jpg" group-title="收藏频道",更新'"$DATE"'' live.m3u
sed -i '3i http://tencentplaygzrb01.gztv.com/live/zonghes.m3u8' live.m3u
- name: 提交更改
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -61,10 +53,11 @@ jobs:
DATE=$(date +"%Y-%m-%d %H:%M:%S")
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git add live.m3u
git add live/live.m3u live/live.txt
if git diff-index --quiet HEAD --; then
echo "没有更改需要提交更新: $DATE"
else
git commit -m "自动更新 M3U 播放列表 $DATE"
git commit -m "自动更新 M3U 和 TXT 文件 $DATE"
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}
fi