Skip to content

Commit a87fe49

Browse files
authored
Add GitHub action for running Core Web Vitals LCP Docker Container (#180)
1 parent 56f8d86 commit a87fe49

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CWV Stats Monthly
2+
3+
on:
4+
# http archive crawl usually starts on the 2nd Tuesday of the month and finishes within ~2weeks usually by the 1st
5+
# of the following month therefore we run the crawl on the 7th to give a full weeks buffer after the crawl finishes.
6+
# https://har.fyi/guides/release-cycle/#running-the-crawl
7+
schedule:
8+
- cron: '0 0 7 * *' # At 00:00 on day-of-month 7 (UTC)
9+
workflow_dispatch: # Allow manual triggering
10+
11+
jobs:
12+
run-cwv-stats-lcp:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: 'read'
16+
id-token: 'write'
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- uses: 'google-github-actions/auth@v3'
23+
with:
24+
project_id: 'httparchive'
25+
workload_identity_provider: '${{ secrets.GCP_WIF_PROVIDER}}'
26+
service_account: '${{ secrets.GCP_SA_EMAIL }}'
27+
28+
- name: Build cwv-stats-lcp image
29+
run: docker build . --target cwv-stats-lcp -t cwv-stats-lcp
30+
31+
# Auth writes credentials to a new path each run and sets GOOGLE_APPLICATION_CREDENTIALS for later steps.
32+
# The credentials file generated by the auth step is owned by the github action user therefore we set the user
33+
# of the container to that of the action thereby allowing the container to read the credentials file.
34+
- name: Run cwv-stats-lcp container
35+
env:
36+
GOOGLE_CLOUD_PROJECT: httparchive
37+
run: |
38+
docker run --rm \
39+
--user "$(id -u):$(id -g)" \
40+
-e GOOGLE_APPLICATION_CREDENTIALS=/app/application_default_credentials.json \
41+
-e GOOGLE_CLOUD_PROJECT \
42+
-v "$GOOGLE_APPLICATION_CREDENTIALS:/app/application_default_credentials.json:ro" \
43+
cwv-stats-lcp

0 commit comments

Comments
 (0)