Skip to content

Commit b777008

Browse files
committed
ci: add release-website workflow to pin and deploy the website
Standalone, manually-triggered workflow that pins the website's @jsonforms/* dependencies to a given stable release, verifies the site builds, pushes the bump, and triggers the Netlify deploy. Kept separate from publish.yaml so a website failure never blocks a published npm release and the site stays independently redeployable. The optional regenerate_docs input rebuilds the typedoc API docs from the current state of master (no tag checkout) and commits the refreshed website/static/api together with the pin, replacing the manual copy-docs step. Run it right after a stable release, while master still matches the released code. Drop the deploy-hook trigger from publish.yaml in favor of this workflow: it fired before the website's dependencies were bumped, so it deployed the site against the previous release. release-website is now the single deploy path; netlify.toml's comment points at it.
1 parent a3bc0e9 commit b777008

3 files changed

Lines changed: 152 additions & 11 deletions

File tree

‎.github/workflows/publish.yaml‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,3 @@ jobs:
9292
run: "pnpm publish --recursive ${{ github.event.inputs.stable_release == 'true' && ' ' || '--tag next' }}"
9393
env:
9494
NPM_CONFIG_PROVENANCE: 'true'
95-
96-
# Publish the documentation website, but only for stable releases. This
97-
# POSTs to a Netlify build hook; automatic Netlify deploys are disabled,
98-
# so the website is never published on regular pushes ("no rolling
99-
# website"). The build renders against the latest stable release.
100-
- name: 'Trigger website deploy'
101-
if: github.event.inputs.skip_publish == 'false' && github.event.inputs.stable_release == 'true'
102-
run: curl -fsS -X POST -d '{}' "${{ secrets.NETLIFY_WEBSITE_BUILD_HOOK }}"
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: 'Release Website'
2+
3+
# Pin the documentation website to a stable JSON Forms release and (re)deploy
4+
# it. This is intentionally separate from publish.yaml: a website failure must
5+
# never taint or block an already-published npm release, and the site also
6+
# needs to be redeployable on its own (docs, news, community changes) without
7+
# cutting a library release.
8+
#
9+
# Run manually after a stable release, passing the released version. It bumps
10+
# the website's @jsonforms/* dependencies to that exact version, verifies the
11+
# site still builds, pushes the bump to master, and triggers the Netlify build
12+
# hook so production is published against the latest stable release.
13+
#
14+
# The optional regenerate_docs flag rebuilds the typedoc API docs from the
15+
# current state of master (no tag checkout) and commits the refreshed
16+
# website/static/api along with the bump. Use it while master still matches
17+
# the released code, i.e. right after a stable release.
18+
on:
19+
workflow_dispatch:
20+
inputs:
21+
version:
22+
type: 'string'
23+
description: 'stable JSON Forms version to pin the website to (e.g. 3.9.0)'
24+
required: true
25+
skip_bump:
26+
type: 'boolean'
27+
description: 'mark to skip the dependency bump and only rebuild/redeploy the current website state'
28+
required: false
29+
default: false
30+
skip_deploy:
31+
type: 'boolean'
32+
description: 'mark to only bump and push, skipping the Netlify deploy trigger'
33+
required: false
34+
default: false
35+
regenerate_docs:
36+
type: 'boolean'
37+
description: 'mark to regenerate the API docs from the current repository state and commit them'
38+
required: false
39+
default: false
40+
41+
jobs:
42+
release-website:
43+
permissions:
44+
contents: 'write'
45+
runs-on: 'ubuntu-latest'
46+
steps:
47+
- uses: 'actions/checkout@v4'
48+
with:
49+
ref: 'master'
50+
token: '${{ secrets.JSONFORMS_PUBLISH_PAT }}'
51+
52+
- name: 'Configure Git Credentials'
53+
run: |
54+
git config user.name "jsonforms-publish[bot]"
55+
git config user.email "jsonforms-publish@eclipsesource.com"
56+
57+
- name: 'Setup node'
58+
uses: 'actions/setup-node@v4'
59+
with:
60+
node-version-file: 'website/.nvmrc'
61+
registry-url: 'https://registry.npmjs.org'
62+
63+
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
64+
if: github.event.inputs.regenerate_docs == 'true'
65+
name: 'Install pnpm'
66+
with:
67+
run_install: false
68+
69+
# Regenerate the API docs from the current repository state. The
70+
# packages are built first because typedoc resolves cross-package types
71+
# from the built lib/ output (same order as ci.yaml).
72+
- name: 'Regenerate API docs'
73+
if: github.event.inputs.regenerate_docs == 'true'
74+
run: |
75+
pnpm i --frozen-lockfile
76+
pnpm run build
77+
pnpm run doc
78+
./website/copy-docs.sh
79+
80+
# Ensure the released version is actually on npmjs before pinning to it.
81+
- name: 'Wait for npm propagation'
82+
if: github.event.inputs.skip_bump == 'false'
83+
run: |
84+
for i in $(seq 1 30); do
85+
if [ "$(npm view @jsonforms/core@${VERSION} version 2> /dev/null)" = "${VERSION}" ]; then
86+
exit 0
87+
fi
88+
echo "@jsonforms/core@${VERSION} not yet available on npmjs, retrying..."
89+
sleep 20
90+
done
91+
echo "@jsonforms/core@${VERSION} did not appear on npmjs in time"
92+
exit 1
93+
env:
94+
VERSION: ${{ github.event.inputs.version }}
95+
96+
- name: 'Bump @jsonforms/* to the released version'
97+
if: github.event.inputs.skip_bump == 'false'
98+
working-directory: 'website'
99+
run: |
100+
npm install --save-exact \
101+
@jsonforms/core@${VERSION} \
102+
@jsonforms/react@${VERSION} \
103+
@jsonforms/material-renderers@${VERSION} \
104+
@jsonforms/examples@${VERSION}
105+
env:
106+
VERSION: ${{ github.event.inputs.version }}
107+
108+
# Install (in case the bump was skipped) and verify the site builds before
109+
# pushing or deploying, so we never publish a broken bump.
110+
- name: 'Install'
111+
if: github.event.inputs.skip_bump == 'true'
112+
working-directory: 'website'
113+
run: npm ci
114+
115+
- name: 'Verify build'
116+
working-directory: 'website'
117+
run: npm run build:current
118+
119+
- name: 'Commit and push'
120+
if: github.event.inputs.skip_bump == 'false' || github.event.inputs.regenerate_docs == 'true'
121+
run: |
122+
if [ "${SKIP_BUMP}" = "false" ]; then
123+
git add website/package.json website/package-lock.json
124+
fi
125+
if [ "${REGENERATE_DOCS}" = "true" ]; then
126+
git add website/static/api
127+
fi
128+
if git diff --cached --quiet; then
129+
echo "Website already up to date, nothing to commit."
130+
elif [ "${SKIP_BUMP}" = "false" ] && [ "${REGENERATE_DOCS}" = "true" ]; then
131+
git commit -m "docs: pin website to JSON Forms ${VERSION} and regenerate API docs"
132+
git push origin HEAD:master
133+
elif [ "${SKIP_BUMP}" = "false" ]; then
134+
git commit -m "docs: pin website to JSON Forms ${VERSION}"
135+
git push origin HEAD:master
136+
else
137+
git commit -m "docs: regenerate website API docs"
138+
git push origin HEAD:master
139+
fi
140+
env:
141+
VERSION: ${{ github.event.inputs.version }}
142+
SKIP_BUMP: ${{ github.event.inputs.skip_bump }}
143+
REGENERATE_DOCS: ${{ github.event.inputs.regenerate_docs }}
144+
145+
# Trigger the production build on Netlify. Automatic Netlify deploys are
146+
# disabled, so this hook is what publishes the site.
147+
- name: 'Trigger website deploy'
148+
if: github.event.inputs.skip_deploy == 'false'
149+
run: curl -fsS -X POST -d '{}' "${{ secrets.NETLIFY_WEBSITE_BUILD_HOOK }}"

‎netlify.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
# The site is published only against the latest stable release, not on every
55
# push ("no rolling website"):
66
# - Automatic production deploys are disabled in the Netlify UI.
7-
# - A Netlify build hook, fired from .github/workflows/publish.yaml on a
8-
# stable release, triggers the production build. `build:current` renders
9-
# against the latest stable @jsonforms/* release.
7+
# - A Netlify build hook, fired from .github/workflows/release-website.yaml
8+
# after a stable release, triggers the production build. The site renders
9+
# against the @jsonforms/* versions pinned by that workflow.
1010
# - The `ignore` command below skips deploy-preview builds for changes that
1111
# don't touch website/ (paths are relative to the base directory).
1212
[build]

0 commit comments

Comments
 (0)