Stock Screener Pipeline #8
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: Stock Screener Pipeline | |
| on: | |
| schedule: | |
| # Run every Saturday at 06:00 UTC | |
| - cron: '0 6 * * 6' | |
| workflow_dispatch: # Allow manual trigger | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: web/app/package-lock.json | |
| - name: Build frontend | |
| working-directory: web/app | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: Restore previous database | |
| uses: dawidd6/action-download-artifact@v6 | |
| with: | |
| name: stocks-database | |
| workflow: screener.yml | |
| workflow_conclusion: '' | |
| search_artifacts: true | |
| if_no_artifact_found: warn | |
| continue-on-error: true | |
| - name: Run ETL pipeline and generate site | |
| run: python generate_site.py | |
| - name: Upload database artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: stocks-database | |
| path: stocks.db | |
| retention-days: 90 | |
| if-no-files-found: ignore | |
| - name: Upload site artifact | |
| if: always() | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _site | |
| deploy: | |
| needs: build | |
| if: always() && needs.build.result != 'cancelled' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |