Refresh Data #17
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: Refresh Data | |
| on: | |
| schedule: | |
| - cron: '0 0 * * 0' # weekly at 00:00 UTC on Sunday | |
| workflow_dispatch: | |
| env: | |
| PYTHON_VERSION: '3.11' | |
| POETRY_VERSION: '2.0.1' | |
| SERVICE_ACCOUNT: 'github-actions-service-account@cal-itp-data-infra.iam.gserviceaccount.com' | |
| WORKLOAD_IDENTITY_PROVIDER: 'projects/1005246706141/locations/global/workloadIdentityPools/github-actions/providers/reports' | |
| PROJECT_ID: 'cal-itp-data-infra' | |
| REPORTS_DATA_BUCKET: 'calitp-reports-data' | |
| jobs: | |
| plan: | |
| name: Apply | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Authenticate Google Service Account | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| create_credentials_file: true | |
| project_id: ${{ env.PROJECT_ID }} | |
| workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }} | |
| service_account: ${{ env.SERVICE_ACCOUNT }} | |
| - name: Setup GCloud utilities | |
| uses: google-github-actions/setup-gcloud@v2 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Cache Poetry | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pypoetry | |
| key: poetry-cache-${{ runner.os }}-python-${{ env.PYTHON_VERSION }}-poetry-${{ env.POETRY_VERSION }} | |
| - name: Setup Poetry | |
| uses: abatilo/actions-poetry@v3 | |
| with: | |
| poetry-version: ${{ env.POETRY_VERSION }} | |
| - name: Cache Python packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.local | |
| key: python-cache-${{ runner.os }}-python-${{ env.PYTHON_VERSION }}-lock-${{ hashFiles('poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }} | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: website/package.json | |
| cache: npm | |
| cache-dependency-path: website/package-lock.json | |
| - name: Install python dependencies | |
| run: poetry install | |
| - name: Install node dependencies | |
| working-directory: website | |
| run: npm install | |
| - name: Compile report parameters | |
| working-directory: reports | |
| run: make parameters | |
| - name: Compile report data | |
| working-directory: reports | |
| run: make data | |
| - name: Upload data | |
| uses: google-github-actions/upload-cloud-storage@v2 | |
| with: | |
| path: './reports/outputs/' | |
| glob: '*' | |
| parent: false | |
| process_gcloudignore: false | |
| destination: ${{ env.REPORTS_DATA_BUCKET }}/report_gtfs_schedule | |
| - name: Build website | |
| working-directory: website | |
| run: poetry run npm run build | |
| - name: Terraform Apply | |
| uses: dflook/terraform-apply@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| auto_approve: true | |
| path: iac/ |