Skip to content

Commit 5fb4331

Browse files
committed
github token
1 parent a13f86f commit 5fb4331

File tree

3 files changed

+14
-29
lines changed

3 files changed

+14
-29
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -54,35 +54,17 @@ jobs:
5454
- name: Get latest release tag
5555
id: release
5656
run: |
57-
# Find the highest-versioned package tag and docs tag (by semver, not
58-
# creation date) so that maintenance patches on older minors never
59-
# cause stable docs to regress to an older codebase.
60-
pick_highest() {
61-
node -e "
62-
const lines = require('fs').readFileSync('/dev/stdin','utf8').trim().split('\n').filter(Boolean);
63-
const parsed = lines.map(tag => {
64-
const ver = tag.split('@').pop();
65-
const [major, minor, patch] = ver.split('.').map(Number);
66-
return { tag, major, minor, patch };
67-
}).filter(t => !isNaN(t.major));
68-
parsed.sort((a, b) => b.major - a.major || b.minor - a.minor || b.patch - a.patch);
69-
if (parsed.length) console.log(parsed[0].tag);
70-
"
71-
}
72-
73-
PKG_TAG=$(git tag --list '@salesforce/*' | pick_highest)
74-
DOCS_TAG=$(git tag --list 'docs@*' | pick_highest)
75-
76-
# Pick whichever tag has the higher semver version
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
7765
LATEST_TAG=""
7866
if [[ -n "$PKG_TAG" && -n "$DOCS_TAG" ]]; then
79-
WINNER=$(node -e "
80-
const a = '${PKG_TAG}'.split('@').pop().split('.').map(Number);
81-
const b = '${DOCS_TAG}'.split('@').pop().split('.').map(Number);
82-
const cmp = a[0]-b[0] || a[1]-b[1] || a[2]-b[2];
83-
console.log(cmp >= 0 ? '${PKG_TAG}' : '${DOCS_TAG}');
84-
")
85-
LATEST_TAG="$WINNER"
67+
LATEST_TAG=$(git tag --list '@salesforce/*' --list 'docs@*' --sort=-creatordate | head -n1)
8668
elif [[ -n "$PKG_TAG" ]]; then
8769
LATEST_TAG="$PKG_TAG"
8870
elif [[ -n "$DOCS_TAG" ]]; then

.github/workflows/publish.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
github.event_name != 'workflow_run' ||
3030
github.event.workflow_run.conclusion == 'success'
3131
permissions:
32+
actions: write # For triggering deploy-docs.yml via workflow_dispatch
3233
contents: write # For creating GitHub releases and tags
3334
id-token: write # Required for npm OIDC trusted publishers
3435
pull-requests: write # For creating merge-back PRs
@@ -339,7 +340,9 @@ jobs:
339340
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
340341

341342
- name: Trigger documentation deployment
342-
if: steps.release-type.outputs.type == 'stable' && steps.changesets.outputs.skip != 'true' && steps.quick-check.outputs.skip != 'true'
343+
if: >-
344+
steps.release-type.outputs.type == 'stable' && steps.changesets.outputs.skip != 'true' && steps.quick-check.outputs.skip != 'true'
345+
&& (steps.packages.outputs.tag_cli == 'latest' || steps.packages.outputs.tag_sdk == 'latest' || steps.packages.outputs.tag_mcp == 'latest' || steps.packages.outputs.publish_docs == 'true')
343346
run: gh workflow run deploy-docs.yml
344347
env:
345348
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

PUBLISHING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ The documentation site serves two versions:
152152
- **Stable** (root URL) — built from the most recent release tag (across all branches)
153153
- **Dev** (`/dev/`) — built from `main`, updated on every push
154154

155-
Stable docs are rebuilt after every stable or release branch publish. The `deploy-docs.yml` workflow builds from the highest semver release tag, so stable docs always reflect the latest release line. Maintenance patches on older minors do not affect stable docs.
155+
Stable docs are rebuilt only when a package publishes to `@latest` (hotfix from the current minor or a regular release) or when a doc-only release is created. Maintenance patches on older minors (which publish to scoped dist-tags like `@release-0.4`) do not trigger a docs rebuild.
156156

157157
## Local Testing
158158

0 commit comments

Comments
 (0)