CRON #7643
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: CRON | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| region: | |
| description: 'Región a ejecutar (vacío = todas)' | |
| required: false | |
| type: choice | |
| options: | |
| - '' | |
| - ar | |
| - cl | |
| - ve | |
| - uy | |
| - mx | |
| - bo | |
| - br | |
| - co | |
| default: '' | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| - name: Cache Playwright browsers | |
| id: playwright-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| playwright-${{ runner.os }}- | |
| - name: Create .env file | |
| run: | | |
| touch .env | |
| echo "VITE_AXIOM_ORG_ID=${{ secrets.VITE_AXIOM_ORG_ID }}" >> .env | |
| echo "VITE_AXIOM_TOKEN=${{ secrets.VITE_AXIOM_TOKEN }}" >> .env | |
| echo "VITE_AXIOM_DATASET=${{ secrets.VITE_AXIOM_DATASET }}" >> .env | |
| echo "VITE_BANXICO_TOKEN=${{ secrets.VITE_BANXICO_TOKEN }}" >> .env | |
| echo "VITE_PREX_API_KEY=${{ secrets.VITE_PREX_API_KEY }}" >> .env | |
| echo "VITE_PLUS_AUTH_KEY=${{ secrets.VITE_PLUS_AUTH_KEY }}" >> .env | |
| echo "VITE_ASTROPAY_AUTH=${{ secrets.VITE_ASTROPAY_AUTH }}" >> .env | |
| echo "VITE_FIRECRAWL_BASE_URL=${{ secrets.VITE_FIRECRAWL_BASE_URL }}" >> .env | |
| echo "VITE_FIRECRAWL_API_KEY=${{ secrets.VITE_FIRECRAWL_API_KEY }}" >> .env | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Install Playwright browsers | |
| run: npx playwright install chromium | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| - name: Install Playwright system dependencies | |
| run: npx playwright install-deps chromium | |
| - name: Build | |
| run: pnpm run cron:build | |
| - name: Run cron | |
| run: pnpm run cron:run | |
| env: | |
| CRON_REGION: ${{ inputs.region }} | |
| - name: Run og | |
| run: pnpm run og:png | |
| - name: Commit and push if changes | |
| run: | | |
| git config --global user.name 'GitHub Actions' | |
| git config --global user.email 'actions@github.com' | |
| git add -A | |
| timestamp=$(date -u) | |
| git commit -m "chore: update data $timestamp" | |
| git push |