-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (102 loc) · 3.61 KB
/
Copy pathdeploy-docs.yml
File metadata and controls
118 lines (102 loc) · 3.61 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
name: Deploy Docs to GitHub Pages
on:
workflow_dispatch:
inputs:
release_tag:
description: 'Published release tag to deploy, for example v3.0.0'
required: true
type: string
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout release
uses: actions/checkout@v4
with:
ref: ${{ inputs.release_tag }}
path: release
- name: Checkout release tooling
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
path: tooling
- name: Verify tag, package and npm registry agree
shell: bash
run: |
RELEASE_TAG='${{ inputs.release_tag }}'
if [[ ! "${RELEASE_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::release_tag must be an exact stable SemVer tag such as v3.0.0"
exit 1
fi
PACKAGE_VERSION=$(node -p "require('./release/package.json').version")
TAG_VERSION=${RELEASE_TAG#v}
REGISTRY_VERSION=$(npm view "monsqlize@${PACKAGE_VERSION}" version --registry=https://registry.npmjs.org/)
if [ "${TAG_VERSION}" != "${PACKAGE_VERSION}" ] || [ "${REGISTRY_VERSION}" != "${PACKAGE_VERSION}" ]; then
echo "::error::tag=${TAG_VERSION}, package=${PACKAGE_VERSION}, registry=${REGISTRY_VERSION} must match"
exit 1
fi
echo "DOCS_RELEASE_VERSION=${PACKAGE_VERSION}" >> "${GITHUB_ENV}"
echo "DOCS_RELEASE_CHANNEL=stable" >> "${GITHUB_ENV}"
- name: Select verified website toolchain
shell: bash
run: |
if node -e "process.exit(require('./release/website/package.json').scripts?.verify ? 0 : 1)"; then
echo "DOCS_LEGACY_TAG=false" >> "${GITHUB_ENV}"
else
cp tooling/website/package.json release/website/package.json
cp tooling/website/package-lock.json release/website/package-lock.json
echo "DOCS_LEGACY_TAG=true" >> "${GITHUB_ENV}"
fi
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: release/website/package-lock.json
- name: Check docs example matrix
run: node release/scripts/validation/check-doc-example-matrix.cjs --require-covered
- name: Install website dependencies
working-directory: ./release/website
run: npm ci
- name: Verify docs site
working-directory: ./release/website
shell: bash
run: |
if [[ "${DOCS_LEGACY_TAG}" != "true" ]]; then
npm run verify
else
npm run build
node ../../tooling/scripts/validation/check-site-links.cjs --dist "${PWD}/dist"
npm audit
fi
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./release/website/dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Summarize stable docs deployment
shell: bash
run: |
{
echo "## Stable documentation deployed"
echo
echo "Release tag: \`${{ inputs.release_tag }}\`"
echo
echo "Pages URL: ${{ steps.deployment.outputs.page_url }}"
} >> "${GITHUB_STEP_SUMMARY}"