@@ -12,7 +12,7 @@ permissions:
1212
1313concurrency :
1414 group : pages
15- cancel-in-progress : false
15+ cancel-in-progress : true
1616
1717jobs :
1818 build :
@@ -54,20 +54,39 @@ jobs:
5454 - name : Get latest release tag
5555 id : release
5656 run : |
57- LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
57+ # Find the most recent package tag and docs tag by creation date.
58+ # This is safe because only @latest publishes and doc-only releases
59+ # trigger this workflow — maintenance patches on older minors are
60+ # excluded by the publish workflow gate.
61+ PKG_TAG=$(git tag --list '@salesforce/*' --sort=-creatordate | head -n1)
62+ DOCS_TAG=$(git tag --list 'docs@*' --sort=-creatordate | head -n1)
63+
64+ # Pick whichever tag was created more recently
65+ LATEST_TAG=""
66+ if [[ -n "$PKG_TAG" && -n "$DOCS_TAG" ]]; then
67+ LATEST_TAG=$(git tag --list '@salesforce/*' --list 'docs@*' --sort=-creatordate | head -n1)
68+ elif [[ -n "$PKG_TAG" ]]; then
69+ LATEST_TAG="$PKG_TAG"
70+ elif [[ -n "$DOCS_TAG" ]]; then
71+ LATEST_TAG="$DOCS_TAG"
72+ fi
73+
74+ echo "Latest package tag: ${PKG_TAG:-<none>}"
75+ echo "Latest docs tag: ${DOCS_TAG:-<none>}"
76+ echo "Building stable docs from: ${LATEST_TAG:-<none>}"
77+
5878 echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT
5979 echo "exists=$([[ -n $LATEST_TAG ]] && echo true || echo false)" >> $GITHUB_OUTPUT
6080
61- - name : Build main documentation
62- run : pnpm run docs:build
63- env :
64- RELEASE_VERSION : ${{ steps.release.outputs.tag }}
81+ - name : Build dev documentation
82+ run : |
83+ IS_DEV_BUILD=true pnpm run docs:build
84+ mv docs/.vitepress/dist docs/.vitepress/dist-dev
6585
66- - name : Build release documentation
86+ - name : Build stable documentation from release tag
6787 if : steps.release.outputs.exists == 'true'
6888 run : |
69- # Save main build and config (config has version dropdown code)
70- mv docs/.vitepress/dist docs/.vitepress/dist-main
89+ # Save config from main (has version dropdown and dynamic base path)
7190 cp docs/.vitepress/config.mts /tmp/config.mts
7291
7392 # Remove S3-extracted uxstudio files before checkout to avoid conflicts
@@ -87,14 +106,17 @@ jobs:
87106 # Restore config from main (has version dropdown and dynamic base path)
88107 cp /tmp/config.mts docs/.vitepress/config.mts
89108
90- # Build at release tag with main's config
109+ # Build at release tag with main's config (no IS_DEV_BUILD = stable at root)
91110 pnpm install --frozen-lockfile
92111 pnpm -r run build
93- RELEASE_VERSION=${{ steps.release.outputs.tag }} IS_RELEASE_BUILD=true pnpm run docs:build
112+ pnpm run docs:build
113+
114+ # Combine: stable at root, dev in /dev/
115+ mv docs/.vitepress/dist-dev docs/.vitepress/dist/dev
94116
95- # Combine: main at root, release in / release/
96- mv docs/.vitepress/dist docs/.vitepress/dist-main/ release
97- mv docs/.vitepress/dist-main docs/.vitepress/dist
117+ - name : Use dev as root when no release exists
118+ if : steps. release.outputs.exists != 'true'
119+ run : mv docs/.vitepress/dist-dev docs/.vitepress/dist
98120
99121 - name : Upload artifact
100122 uses : actions/upload-pages-artifact@v3
0 commit comments