Update schedule #603
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Update schedule' | |
on: | |
schedule: | |
- cron: '0 22 * * *' | |
- cron: '0 10 * * *' | |
workflow_dispatch: | |
branches: | |
- master | |
- dev | |
- gd | |
- gd-test | |
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.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
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.getboolean("Settings", "open_driver", fallback=True) | |
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.getboolean("Settings", "open_ffmpeg", fallback=True) | |
except: | |
open_ffmpeg = False | |
print(open_ffmpeg)')" >> $GITHUB_ENV | |
- name: Set up Chrome | |
if: env.OPEN_DRIVER == 'True' || env.OPEN_DRIVER == 'true' | |
uses: browser-actions/setup-chrome@latest | |
with: | |
chrome-version: stable | |
- name: Download chrome driver | |
if: env.OPEN_DRIVER == 'True' || env.OPEN_DRIVER == 'true' | |
uses: nanasess/setup-chromedriver@master | |
- name: Install FFmpeg | |
if: env.OPEN_FFMPEG == 'True' || 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.8 && 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: | |
from utils.config import config | |
final_file = config.get("Settings", "final_file", fallback="output/result.txt") | |
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.get("Settings", "final_file", fallback="output/result.txt") | |
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 "result.txt" ]]; then | |
git add -f "result.txt" | |
fi | |
if [[ -f "$final_m3u_file" ]]; then | |
git add -f "$final_m3u_file" | |
fi | |
if [[ -f "result.m3u" ]]; then | |
git add -f "result.m3u" | |
fi | |
if [[ -f "output/result_cache.pkl" ]]; then | |
git add -f "output/result_cache.pkl" | |
fi | |
if [[ -f "output/user_result.log" ]]; then | |
git add -f "output/user_result.log" | |
elif [[ -f "output/result.log" ]]; then | |
git add -f "output/result.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 |