FetchStockData #1129
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: FetchStockData | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '20 4 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Configure pip caching | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Copy master folder | |
run: |- | |
rsync -Rr ./ ./master/ | |
- name: Checkout data branch | |
run: |- | |
git checkout data | |
- name: Download norn-data | |
uses: actions/checkout@v2 | |
with: | |
ref: gh-pages | |
repository: zmcx16/Norn-StockScreener | |
path: './Norn-StockScreener' | |
- name: Delete dataset folder & move norn-data to dataset | |
run: |- | |
rm -rf ./master/dataset | |
mv ./Norn-StockScreener/norn-data ./master/dataset | |
mv ./master/dataset/markets ./master/dataset/historical-quotes | |
mkdir ./master/dataset/markets | |
mv ./master/dataset/historical-quotes ./master/dataset/markets/historical-quotes | |
- name: Update forecast_config.json | |
uses: wei/wget@v1 | |
with: | |
args: -O ./master/forecast_config.json https://raw.githubusercontent.com/zmcx16/zmcx16.github.io/master/plugin-react/forecast_config.json | |
- name: Install Python dependencies | |
run: | | |
python -m pip install -r ./master/requirements.txt --use-pep517 | |
pip uninstall holidays -y | |
pip install holidays==0.24 | |
- name: Run forecast | |
# env: | |
# GCP_URL: ${{ secrets.GCP_URL }} | |
run: |- | |
python ./master/main.py | |
- name: Copy forecast_output | |
run: |- | |
cp -r ./master/forecast_output ./ | |
- name: Delete master folder | |
run: |- | |
rm -rf ./master | |
- name: Add forecast_output and push it | |
run: |- | |
git config --global user.name "zmcx16-bot" | |
git reset --soft HEAD~1 | |
git add ./forecast_output/\* && git commit -m "updated forecast_output" | |
git push -f | |
- name: Checkout zmcx16.github.io | |
uses: actions/checkout@master | |
with: | |
repository: zmcx16/zmcx16.github.io | |
token: ${{ secrets.ACTIONS_TOKEN }} | |
path: ./zmcx16.github.io | |
- name: Copy forecast-data & push zmcx16.github.io | |
run: |- | |
cp -r ./forecast_output ./zmcx16.github.io/ | |
cd ./zmcx16.github.io | |
rm -rf forecast-data | |
mv forecast_output forecast-data | |
git config --global user.name "zmcx16-bot" | |
git add ./forecast-data/\* && git commit -m "updated forecast-data" | |
git push |