11name : Deploy Documentation
22
33on :
4- push :
5- branches : [main]
64 workflow_dispatch :
75
86permissions :
5250 - name : Get latest release tag
5351 id : release
5452 run : |
55- # Find the most recent package tag and docs tag by creation date.
56- # This is safe because only @latest publishes and doc-only releases
57- # trigger this workflow — maintenance patches on older minors are
58- # excluded by the publish workflow gate.
5953 PKG_TAG=$(git tag --list '@salesforce/*' --sort=-creatordate | head -n1)
6054 DOCS_TAG=$(git tag --list 'docs@*' --sort=-creatordate | head -n1)
6155
62- # Pick whichever tag was created more recently
6356 LATEST_TAG=""
6457 if [[ -n "$PKG_TAG" && -n "$DOCS_TAG" ]]; then
6558 LATEST_TAG=$(git tag --list '@salesforce/*' --list 'docs@*' --sort=-creatordate | head -n1)
@@ -69,58 +62,38 @@ jobs:
6962 LATEST_TAG="$DOCS_TAG"
7063 fi
7164
72- echo "Latest package tag: ${PKG_TAG:-<none>}"
73- echo "Latest docs tag: ${DOCS_TAG:-<none>}"
74- echo "Building stable docs from: ${LATEST_TAG:-<none>}"
75-
65+ echo "Building docs from: ${LATEST_TAG:-<none>}"
7666 echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT
77- echo "exists=$([[ -n $LATEST_TAG ]] && echo true || echo false)" >> $GITHUB_OUTPUT
78-
79- - name : Build dev documentation
80- run : |
81- IS_DEV_BUILD=true pnpm run docs:build
82- mv docs/.vitepress/dist docs/.vitepress/dist-dev
8367
84- - name : Build stable documentation from release tag
85- if : steps.release.outputs.exists == 'true'
68+ - name : Build documentation from release tag
8669 run : |
87- # Save docs build files from main (config has version dropdown/dynamic
88- # base path, and package.json/lockfile have its dependencies)
70+ # Save config and deps from main (has version dropdown and latest dependencies)
8971 cp docs/.vitepress/config.mts /tmp/config.mts
9072 cp docs/package.json /tmp/docs-package.json
9173 cp pnpm-lock.yaml /tmp/pnpm-lock.yaml
9274
9375 # Remove S3-extracted uxstudio files before checkout to avoid conflicts
94- # (older tags still have these files tracked in git)
9576 rm -rf docs/public/uxstudio
9677
9778 # Checkout release tag
9879 git checkout ${{ steps.release.outputs.tag }}
9980
100- # Ensure UX Studio artifacts are present (older tags have them in git,
101- # future tags won't — always extract from S3 to be safe)
81+ # Restore UX Studio artifacts
10282 rm -rf docs/public/uxstudio
10383 mkdir -p docs/public/uxstudio
10484 tar -xzf /tmp/uxstudio-4.5.tar.gz -C docs/public/uxstudio
10585 tar -xzf /tmp/uxstudio-4.6.tar.gz -C docs/public/uxstudio
10686
107- # Restore docs build files from main so dependencies match the config
87+ # Restore config and deps from main
10888 cp /tmp/config.mts docs/.vitepress/config.mts
10989 cp /tmp/docs-package.json docs/package.json
11090 cp /tmp/pnpm-lock.yaml pnpm-lock.yaml
11191
112- # Build at release tag with main's config (no IS_DEV_BUILD = stable at root)
92+ # Build docs
11393 pnpm install --frozen-lockfile
11494 pnpm -r run build
11595 pnpm run docs:build
11696
117- # Combine: stable at root, dev in /dev/
118- mv docs/.vitepress/dist-dev docs/.vitepress/dist/dev
119-
120- - name : Use dev as root when no release exists
121- if : steps.release.outputs.exists != 'true'
122- run : mv docs/.vitepress/dist-dev docs/.vitepress/dist
123-
12497 - name : Upload artifact
12598 uses : actions/upload-pages-artifact@v4
12699 with :
0 commit comments