-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (84 loc) · 2.93 KB
/
refresh-data.yml
File metadata and controls
103 lines (84 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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/