.github/workflows/run_tracker_github.yml #45
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: Run Red Bull Tracker | |
on: | |
schedule: | |
- cron: "0 7 * * *" # Runs at 07:00 UTC every day | |
push: | |
paths: | |
- .**/run_tracker_github.yml | |
workflow_dispatch: | |
permissions: | |
contents: write | |
env: | |
PG_DB_CONNECTION: ${{secrets.PG_DB_CONNECTION}} | |
PG_DB_NAME: ${{secrets.PG_DB_NAME}} | |
PG_DB_PORT: ${{secrets.PG_DB_PORT}} | |
PG_PASSWORD: ${{secrets.PG_PASSWORD}} | |
PG_USER: ${{secrets.PG_USER}} | |
DOCKERHUB_USERNAME: ${{secrets.DOCKERHUB_USERNAME}} | |
DOCKERHUB_TOKEN: ${{secrets.DOCKERHUB_TOKEN}} | |
jobs: | |
run-in-docker: | |
runs-on: ubuntu-20.04 | |
container: vazome/redbull-tracker-ge:tracker-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
run.py | |
sparse-checkout-cone-mode: false | |
- name: Install dependencies | |
run: | | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Run Python script | |
run: python ./run.py | |
- name: Upload export file | |
uses: actions/upload-artifact@v4 | |
with: | |
name: export | |
path: export/export*.json | |
overwrite: true | |
run-in-actions: | |
needs: run-in-docker | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download export file | |
uses: actions/download-artifact@v4 | |
with: | |
name: export | |
path: ./export | |
- name: Commit report | |
run: | | |
pwd | |
git config --global user.name 'vazome' | |
git config --global user.email '[email protected]' | |
git add ./export/* | |
git commit -am "Adding more price reports to export" | |
git push | |
# Not needed to utilize artifacts | |
# - name: Copy generated files from container | |
# run: | | |
# docker cp redbull-tracker-ge:/usr/src/app "${{github.workspace}}" |