Update live.yml
This commit is contained in:
parent
0a11b347a3
commit
5a7abd43d2
27
.github/workflows/live.yml
vendored
27
.github/workflows/live.yml
vendored
@ -16,12 +16,12 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 检出仓库
|
- name: 检出仓库
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: 设置Python环境
|
- name: 设置Python环境
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.8'
|
python-version: '3.10'
|
||||||
|
|
||||||
- name: 安装依赖
|
- name: 安装依赖
|
||||||
run: |
|
run: |
|
||||||
@ -33,27 +33,19 @@ jobs:
|
|||||||
|
|
||||||
- name: 检查文件是否生成
|
- name: 检查文件是否生成
|
||||||
run: |
|
run: |
|
||||||
if [ -f "live.m3u" ]; then
|
if [ -f "live/live.m3u" ]; then
|
||||||
echo "文件已生成"
|
echo "live.m3u 文件已生成"
|
||||||
else
|
else
|
||||||
echo "文件未生成"
|
echo "live.m3u 文件未生成"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ -f "live.txt" ]; then
|
if [ -f "live/live.txt" ]; then
|
||||||
echo "live.txt 文件已生成"
|
echo "live.txt 文件已生成"
|
||||||
else
|
else
|
||||||
echo "live.txt 文件未生成"
|
echo "live.txt 文件未生成"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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: 提交更改
|
- name: 提交更改
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@ -61,10 +53,11 @@ jobs:
|
|||||||
DATE=$(date +"%Y-%m-%d %H:%M:%S")
|
DATE=$(date +"%Y-%m-%d %H:%M:%S")
|
||||||
git config --global user.name "GitHub Actions"
|
git config --global user.name "GitHub Actions"
|
||||||
git config --global user.email "actions@github.com"
|
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
|
if git diff-index --quiet HEAD --; then
|
||||||
echo "没有更改需要提交更新: $DATE"
|
echo "没有更改需要提交更新: $DATE"
|
||||||
else
|
else
|
||||||
git commit -m "自动更新 M3U 播放列表: $DATE"
|
git commit -m "自动更新 M3U 和 TXT 文件: $DATE"
|
||||||
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}
|
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user