forked from Guovin/iptv-api
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (66 loc) · 2.1 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
name: 'update schedule'
on:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
branches:
- master
- dev
jobs:
push:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
# in this example, there is a newer version already installed, 3.7.7, so the older version will be downloaded
operating-system: ['ubuntu-20.04']
steps:
- uses: actions/checkout@v3 # Checking out the repo
- name: Run with setup-python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
update-environment: false
cache: 'pipenv'
- name: Install Selenium
run: |
sudo pip3 install selenium
- name: Set up Chrome
uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- name: Download chrome driver
uses: nanasess/setup-chromedriver@master
- name: Launch chrome driver
run: |
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
- name: Install pipenv
run: pip3 install --user pipenv
- name: Install dependecies
run: pipenv --python python3 && pipenv install
- name: Build
run: pipenv run build
- 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:
import user_config as config
except ImportError:
import config
print(config.final_file)')
if [[ -f "$final_file" ]]; then
git add "$final_file"
fi
if [[ -f user_result.log ]]; then
git add user_result.log
elif [[ -f result.log ]]; then
git add result.log
fi
if ! git diff --staged --quiet; then
git commit -m "Github Action Auto Updated"
git push --force
fi