-
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (86 loc) · 3.55 KB
/
Copy pathdocs-deploy.yml
File metadata and controls
97 lines (86 loc) · 3.55 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
name: Deploy documentation site
on:
push:
branches:
- main
paths:
- apps/website/**
- packages/**
- package.json
- pnpm-lock.yaml
- pnpm-workspace.yaml
- turbo.json
- wrangler.jsonc
workflow_dispatch:
permissions:
contents: read
concurrency:
group: docs-deploy-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
name: Build and deploy docs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build documentation
run: pnpm --filter @postcss-plugins/website build
- name: Verify generated documentation assets
run: |
test -s apps/website/.vitepress/dist/logo.svg
test -s apps/website/.vitepress/dist/favicon.svg
test -s apps/website/.vitepress/dist/robots.txt
test -s apps/website/.vitepress/dist/sitemap.xml
test -s apps/website/.vitepress/dist/_headers
- name: Deploy to Cloudflare Workers
run: pnpm exec wrangler deploy --config wrangler.jsonc
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Smoke test deployed documentation
env:
DOCS_URL: https://postcss.icebreaker.top
run: |
set -euo pipefail
for path in \
/ \
/zh-CN/ \
/logo.svg \
/favicon.svg \
/robots.txt \
/sitemap.xml \
/plugins/postcss-plugin-shared/ \
/plugins/postcss-rem-to-responsive-pixel/ \
/plugins/postcss-rem-to-viewport/ \
/plugins/postcss-pxtrans/ \
/plugins/postcss-rule-unit-converter/ \
/plugins/postcss-rule-unit-converter/api \
/plugins/postcss-rule-unit-converter/cookbook \
/plugins/postcss-rule-unit-converter/migration \
/plugins/postcss-rule-unit-converter/preset-authoring \
/plugins/postcss-units-to-px/ \
/zh-CN/plugins/postcss-plugin-shared/ \
/zh-CN/plugins/postcss-rem-to-responsive-pixel/ \
/zh-CN/plugins/postcss-rem-to-viewport/ \
/zh-CN/plugins/postcss-pxtrans/ \
/zh-CN/plugins/postcss-rule-unit-converter/ \
/zh-CN/plugins/postcss-rule-unit-converter/api \
/zh-CN/plugins/postcss-rule-unit-converter/cookbook \
/zh-CN/plugins/postcss-rule-unit-converter/migration \
/zh-CN/plugins/postcss-rule-unit-converter/preset-authoring \
/zh-CN/plugins/postcss-units-to-px/; do
curl --fail --silent --show-error --location --retry 5 --retry-delay 2 --retry-all-errors "$DOCS_URL$path" -o /dev/null
done
test "$(curl --silent --show-error --location --retry 5 --retry-delay 2 --retry-all-errors -o /dev/null -w '%{http_code}' "$DOCS_URL/does-not-exist")" = 404
curl --fail --silent --show-error --location --retry 5 --retry-delay 2 --retry-all-errors -D - -o /dev/null "$DOCS_URL/" | grep -Eiq '^x-content-type-options:[[:space:]]*nosniff'