main.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. name: 'Update schedule'
  2. on:
  3. schedule:
  4. - cron: '0 22,10 * * *'
  5. workflow_dispatch:
  6. branches:
  7. - master
  8. - dev
  9. - gd
  10. jobs:
  11. push:
  12. runs-on: ${{ matrix.operating-system }}
  13. timeout-minutes: 120
  14. strategy:
  15. matrix:
  16. operating-system: [ 'ubuntu-20.04' ]
  17. steps:
  18. - name: Set branch name
  19. id: vars
  20. run: echo "BRANCH_NAME=${{ github.repository_owner == 'Guovin' && 'gd' || 'master' }}" >> $GITHUB_ENV
  21. - uses: actions/checkout@v3
  22. with:
  23. ref: ${{ env.BRANCH_NAME }}
  24. - name: Run with setup-python 3.13
  25. uses: actions/setup-python@v4
  26. with:
  27. python-version: '3.13'
  28. update-environment: true
  29. cache: 'pipenv'
  30. - name: Check open_driver config
  31. id: check_driver
  32. run: |
  33. echo "OPEN_DRIVER=$(python -c '
  34. try:
  35. from utils.config import config
  36. open_driver = config.open_driver
  37. except:
  38. open_driver = False
  39. print(open_driver)')" >> $GITHUB_ENV
  40. - name: Set up Chrome
  41. if: env.OPEN_DRIVER == 'True'
  42. uses: browser-actions/setup-chrome@latest
  43. with:
  44. chrome-version: stable
  45. - name: Download chrome driver
  46. if: env.OPEN_DRIVER == 'True'
  47. uses: nanasess/setup-chromedriver@master
  48. - name: Install FFmpeg
  49. run: sudo apt-get update && sudo apt-get install -y ffmpeg
  50. - name: Install pipenv
  51. run: pip3 install --user pipenv
  52. - name: Install dependecies
  53. run: pipenv --python 3.13 && pipenv install --deploy
  54. - name: Install selenium
  55. if: env.OPEN_DRIVER == 'True'
  56. run: pipenv install selenium
  57. - name: Update
  58. run: pipenv run dev
  59. - name: Commit and push if changed
  60. run: |
  61. git config --local user.email "github-actions[bot]@users.noreply.github.com"
  62. git config --local user.name "github-actions[bot]"
  63. git add .
  64. if ! git diff --staged --quiet; then
  65. git commit -m "Github Action Auto Updated"
  66. git push --force
  67. fi