Run auto #155
This file contains hidden or 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: Run auto | |
| on: | |
| schedule: | |
| - cron: "1 16 * * *" | |
| - cron: "0 6 * * *" | |
| workflow_dispatch: | |
| jobs: | |
| run-main: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| shell: pwsh | |
| run: | | |
| python -m pip install --upgrade pip | |
| if (Test-Path requirements.txt) { | |
| pip install -r requirements.txt | |
| } | |
| env: | |
| PYTHONIOENCODING: utf-8 | |
| - name: Install Google Chrome | |
| run: | | |
| $ProgressPreference = 'SilentlyContinue' | |
| Invoke-WebRequest -Uri "https://dl.google.com/chrome/install/latest/chrome_installer.exe" -OutFile "chrome_installer.exe" | |
| Start-Process -FilePath "chrome_installer.exe" -ArgumentList "/silent /install" -NoNewWindow -Wait | |
| - name: Install ChromeDriver | |
| run: | | |
| $chromeVersion = (Invoke-WebRequest -Uri "https://chromedriver.storage.googleapis.com/LATEST_RELEASE").Content | |
| Invoke-WebRequest -Uri "https://chromedriver.storage.googleapis.com/$chromeVersion/chromedriver_win32.zip" -OutFile "chromedriver.zip" | |
| Expand-Archive chromedriver.zip -DestinationPath "./chromedriver-win64/" | |
| $Env:PATH += ";$PWD\chromedriver-win64" | |
| - name: Check ChromeDriver Installation | |
| run: | | |
| if (-not (Test-Path "./chromedriver-win64/chromedriver.exe")) { | |
| throw "ChromeDriver not found at expected location" | |
| } | |
| - name: Set ChromeDriver Path | |
| run: | | |
| $Env:PATH += ";$PWD\chromedriver-win64" | |
| - name: Run main.py | |
| env: | |
| SETTINGS_JSON: ${{ secrets.SETTINGS_JSON }} | |
| run: | | |
| echo $env:SETTINGS_JSON > setting.json | |
| python main.py | |
| Remove-Item setting.json |