forked from Guovin/iptv-api
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (113 loc) · 3.72 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: 'Update schedule'
on:
schedule:
- cron: '0 22 * * *'
- cron: '0 10 * * *'
workflow_dispatch:
branches:
- master
- dev
- gd
jobs:
push:
runs-on: ${{ matrix.operating-system }}
timeout-minutes: 120
strategy:
matrix:
operating-system: ['ubuntu-20.04']
steps:
- name: Set branch name
id: vars
run: echo "BRANCH_NAME=${{ github.repository_owner == 'Guovin' && 'gd' || 'master' }}" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
ref: ${{ env.BRANCH_NAME }}
- name: Run with setup-python 3.13
uses: actions/setup-python@v4
with:
python-version: '3.13'
update-environment: true
cache: 'pipenv'
- name: Check open_driver config
id: check_driver
run: |
echo "OPEN_DRIVER=$(python -c '
try:
from utils.config import config
open_driver = config.open_driver
except:
open_driver = False
print(open_driver)')" >> $GITHUB_ENV
# - name: Check open_ffmpeg config
# id: check_ffmpeg
# run: |
# echo "OPEN_FFMPEG=$(python -c '
# try:
# from utils.config import config
# open_ffmpeg = config.open_ffmpeg
# except:
# open_ffmpeg = False
# print(open_ffmpeg)')" >> $GITHUB_ENV
- name: Set up Chrome
if: env.OPEN_DRIVER == 'True'
uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- name: Download chrome driver
if: env.OPEN_DRIVER == 'True'
uses: nanasess/setup-chromedriver@master
# - name: Install FFmpeg
# if: env.OPEN_FFMPEG == 'True'
# run: sudo apt-get update && sudo apt-get install -y ffmpeg
- name: Install pipenv
run: pip3 install --user pipenv
- name: Install dependecies
run: pipenv --python 3.13 && pipenv install --deploy
- name: Install selenium
if: env.OPEN_DRIVER == 'True'
run: pipenv install selenium
- name: Update
run: pipenv run dev
- name: Commit and push if changed
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git diff
final_file=$(python -c '
try:
from utils.config import config
final_file = config.final_file
except:
final_file = "output/result.txt"
print(final_file)')
final_m3u_file=$(python -c '
try:
from utils.config import config
import os
final_file = config.final_file
final_m3u_file = os.path.splitext(final_file)[0] + ".m3u"
except:
final_m3u_file = "output/result.m3u"
print(final_m3u_file)')
if [[ -f "$final_file" ]]; then
git add -f "$final_file"
fi
if [[ -f "$final_m3u_file" ]]; then
git add -f "$final_m3u_file"
fi
if [[ -f "output/cache.pkl" ]]; then
git add -f "output/cache.pkl"
fi
if [[ -f "output/sort.log" ]]; then
git add -f "output/sort.log"
fi
if [[ -f "updates/fofa/fofa_hotel_region_result.pkl" ]]; then
git add -f "updates/fofa/fofa_hotel_region_result.pkl"
fi
if [[ -f "updates/fofa/fofa_multicast_region_result.pkl" ]]; then
git add -f "updates/fofa/fofa_multicast_region_result.pkl"
fi
if ! git diff --staged --quiet; then
git commit -m "Github Action Auto Updated"
git push --force
fi