1+ name : Screenshot Capture
2+
3+ on :
4+ schedule :
5+ - cron : ' 0 0 * * 0' # Weekly on Sunday at midnight UTC
6+ workflow_dispatch :
7+
8+ env :
9+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
10+ PALETTE_API_KEY : ${{ secrets.PALETTE_API_KEY }}
11+ FULLSTORY_ORGID : ${{ secrets.FULLSTORY_ORGID }}
12+ ALGOLIA_ADMIN_KEY : ${{ secrets.ALGOLIA_ADMIN_KEY }}
13+ ALGOLIA_APP_ID : ${{ secrets.ALGOLIA_APP_ID }}
14+ ALGOLIA_SEARCH_KEY : ${{ secrets.ALGOLIA_SEARCH_KEY }}
15+ ALGOLIA_INDEX_NAME : ${{ secrets.ALGOLIA_INDEX_NAME }}
16+ DISABLE_PACKS_INTEGRATIONS : ${{ secrets.DISABLE_PACKS_INTEGRATIONS }}
17+ DISABLE_SECURITY_INTEGRATIONS : ${{ secrets.DISABLE_SECURITY_INTEGRATIONS }}
18+ SHOW_LAST_UPDATE_TIME : ${{ secrets.SHOW_LAST_UPDATE_TIME }}
19+ DSO_AUTH_TOKEN : ${{ secrets.DSO_AUTH_TOKEN }}
20+ SEERS_CMP_KEY : ${{ secrets.SEERS_CMP_KEY }}
21+
22+ jobs :
23+ create-assets :
24+ name : asset-builds
25+ runs-on : ubuntu-latest
26+ permissions :
27+ contents : read
28+ steps :
29+ - name : Checkout Repository
30+ uses : actions/checkout@v5
31+
32+ - name : Setup Node.js Environment
33+ uses : actions/setup-node@v4
34+ with :
35+ node-version : " 20"
36+ cache : ' yarn'
37+
38+ - name : Install Dependencies
39+ run : yarn install --frozen-lockfile
40+
41+ - name : Install Playwright browsers
42+ run : npx playwright install --with-deps chromium
43+
44+ - name : Build Website
45+ run : |
46+ touch .env
47+ yarn build
48+
49+ - name : Upload Build
50+ uses : actions/upload-artifact@v4
51+ with :
52+ name : build
53+ path : build/
54+ if-no-files-found : error
55+ retention-days : 1
56+
57+ visual-snapshots :
58+ runs-on : ubuntu-latest
59+ needs : [create-assets]
60+ permissions :
61+ contents : read
62+ actions : read
63+ strategy :
64+ fail-fast : false
65+ matrix :
66+ shardIndex : [1, 2, 3, 4]
67+ shardTotal : [4]
68+ steps :
69+ - name : Checkout Repository
70+ uses : actions/checkout@v5
71+
72+ - name : Setup Node.js Environment
73+ uses : actions/setup-node@v4
74+ with :
75+ node-version : " 20"
76+ cache : ' yarn'
77+
78+ - name : Install Dependencies
79+ uses : Wandalen/wretry.action@v3
80+ with :
81+ command : yarn install --frozen-lockfile
82+ attempt_limit : 3
83+ attempt_delay : 60000
84+
85+ - name : Install Playwright browsers
86+ run : npx playwright install --with-deps chromium
87+
88+ - name : Download build artifact
89+ uses : Wandalen/wretry.action@v3
90+ with :
91+ attempt_limit : 3
92+ attempt_delay : 60000
93+ action : actions/download-artifact@v5
94+ with : |
95+ name: build
96+ path: build
97+
98+ - name : Take Screenshots with Playwright
99+ env :
100+ PLAYWRIGHT_SNAPSHOT_DIR : ${{ github.workspace }}/screenshots
101+ run : npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --update-snapshots || exit 0
102+
103+ - name : Upload Screenshots
104+ uses : actions/upload-artifact@v4
105+ with :
106+ name : screenshots-${{ matrix.shardIndex }}
107+ path : screenshots/
108+ if-no-files-found : error
109+ retention-days : 3
110+
111+ merge-snapshots :
112+ name : Merge Screenshots
113+ runs-on : ubuntu-latest
114+ needs : [visual-snapshots]
115+ permissions :
116+ actions : read
117+ steps :
118+ - name : Download screenshots
119+ uses : actions/download-artifact@v5
120+ with :
121+ path : screenshots
122+ pattern : screenshots-*
123+ merge-multiple : true
124+
125+ - name : Upload merged screenshots
126+ uses : actions/upload-artifact@v4
127+ with :
128+ name : screenshots
129+ path : screenshots/
130+ if-no-files-found : error
131+ retention-days : 14
0 commit comments