Get Data and Deploy #1386
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: Get Data and Deploy | |
| on: | |
| #push: | |
| #branches: [ main ] | |
| schedule: | |
| - cron: "0 23 * * 1-5" | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| env: | |
| # Python version to use | |
| PYTHON_VERSION: 3.12.4 | |
| # Ensures Python uses UTF-8 encoding by default | |
| PYTHONUTF8: 1 | |
| jobs: | |
| get-data: | |
| name: Get Data | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [windows-latest] # ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install "pandas==2.2.2" "requests==2.32.4" "pyquery==2.0.1" "numpy==2.1.0" "python-calamine==0.3.2" "lxml==5.3.0" "html5lib==1.1" "beautifulsoup4==4.12.3" "aiohttp==3.12.14" "thefuzz==0.22.1" | |
| - name: Set console encoding to UTF-8 on Windows | |
| if: matrix.os == 'windows-latest' | |
| shell: bash | |
| run: echo "PYTHONIOENCODING=utf-8" >> $GITHUB_ENV | |
| - run: python get_extraData.py | |
| - run: python get_extraData_fund.py | |
| - run: python tw_analysis_data.py | |
| # continue-on-error: true | |
| - name: Update master | |
| run: | | |
| git config --global user.name 'z-Wind' | |
| git config --global user.email 'zpsyhapcst@gmail.com' | |
| git add . | |
| git diff --cached --exit-code || git commit -m "Regularly update extra Data" | |
| git push | |
| deploy: | |
| needs: get-data | |
| name: Deploy | |
| runs-on: ubuntu-latest #windows-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| override: true | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install "yfinance>=0.2,<0.3" "pandas==2.2.2" "pyquery==2.0.1" "flask==3.0.3" "plotly==5.23.0" "requests==2.32.4" "numpy==2.1.0" "maturin==1.7.0" "pyxirr==0.10.5" "python-calamine==0.3.2" "lxml==5.3.0" "html5lib==1.1" "beautifulsoup4==4.12.3" "minify_html==0.16.4" "jsmin==3.0.1" "thefuzz==0.22.1" | |
| - working-directory: ./FFI/rust_pyo3 | |
| run: | | |
| maturin build --release | |
| python -m pip install ./target/wheels/rust_pyo3-*.whl | |
| - name: Stock | |
| run: python stock.py | |
| - name: TW Analysis | |
| run: python tw_analysis.py | |
| # continue-on-error: true | |
| - name: TW Food | |
| run: python tw_food.py | |
| - name: Deploy | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./report # The folder the action should deploy. | |
| publish_branch: gh-pages # The branch the action should deploy to. |