-
Notifications
You must be signed in to change notification settings - Fork 307
144 lines (117 loc) · 4.38 KB
/
deploy-live.yml
File metadata and controls
144 lines (117 loc) · 4.38 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Deploy Live
on:
push:
branches: [main]
permissions: {}
concurrency:
group: deploy-live
cancel-in-progress: false
jobs:
build:
if: github.repository == 'PaloAltoNetworks/docusaurus-openapi-docs'
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: "22"
cache: "yarn"
- name: Install dependencies
run: yarn --frozen-lockfile --prefer-offline --ignore-scripts
- name: Build packages
run: yarn build-packages
- name: Build site
run: yarn build-demo && zip -r build.zip demo/build
- name: Check for tampered config
run: git diff --exit-code -- firebase.json .firebaserc package.json yarn.lock 'demo/docusaurus.config.*' 'scripts/**' '.github/**'
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build
path: build.zip
deploy:
if: ${{ github.repository == 'PaloAltoNetworks/docusaurus-openapi-docs' }}
name: Deploy
needs: build
runs-on: ubuntu-latest
environment: production
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: "22"
cache: "yarn"
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
with:
workload_identity_provider: ${{ secrets.WIF_PROVIDER }}
service_account: ${{ secrets.WIF_SERVICE_ACCOUNT }}
- name: Read GCP credentials
id: creds
run: |
creds=$(cat "${{ steps.auth.outputs.credentials_file_path }}")
echo "::add-mask::$creds"
echo "sa_key=$creds" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: build
- name: Unzip build artifact
run: unzip -n build.zip 'demo/build/*'
- name: Deploy to Firebase
id: deploy_live
uses: FirebaseExtended/action-hosting-deploy@e2eda2e106cfa35cdbcf4ac9ddaf6c4756df2c8c # v0.10.0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ steps.creds.outputs.sa_key }}"
projectId: pandev
channelId: live
target: docusaurus-openapi.tryingpan.dev
env:
FIREBASE_CLI_PREVIEWS: hostingchannels
cache_prod_screenshots:
name: Cache Prod Screenshots
needs: deploy
if: ${{ github.repository == 'PaloAltoNetworks/docusaurus-openapi-docs' }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: "22"
cache: "yarn"
- name: Install dependencies
run: yarn --frozen-lockfile --prefer-offline --ignore-scripts
- name: Install Playwright
run: npx playwright install --with-deps chromium
- name: Get production sitemap hash
id: sitemap-hash
run: |
hash=$(curl -fsSL https://docusaurus-openapi.tryingpan.dev/sitemap.xml | sha256sum | cut -d' ' -f1)
echo "hash=$hash" >> "$GITHUB_OUTPUT"
- name: Capture production screenshots
run: yarn ts-node scripts/sitemap-visual-diff.ts --preview-url https://docusaurus-openapi.tryingpan.dev/ --concurrency 4 --paths "/tests/"
- name: Save production screenshots
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: visual_diffs/prod
key: prod-screenshots-${{ steps.sitemap-hash.outputs.hash }}