Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit fb46b9a

Browse files
authored
ci: Harden docs publish to only run with a vercel token (#3389)
1 parent 827176e commit fb46b9a

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

docs/build.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@ cd "$(dirname "$0")"
66
# shellcheck source=ci/env.sh
77
source ../ci/env.sh
88

9-
# Publish only from merge commits and release tags
10-
if [[ -n $CI ]]; then
11-
if [[ -z $CI_PULL_REQUEST ]]; then
12-
npm install --global docusaurus-init
13-
docusaurus-init
14-
npm install --global vercel
15-
fi
9+
# Publish only if in CI, vercel token is present, and it's not a pull request
10+
if [[ -n $CI ]] && [[ -n $VERCEL_TOKEN ]] && [[ -z $CI_PULL_REQUEST ]]; then
11+
PUBLISH_DOCS=true
12+
else
13+
PUBLISH_DOCS=
14+
fi
15+
16+
if [[ -n $PUBLISH_DOCS ]]; then
17+
npm install --global docusaurus-init
18+
docusaurus-init
19+
npm install --global vercel
1620
fi
1721

1822
# Build from /src into /build
1923
npm run build
2024

21-
# Publish only from merge commits and release tags
22-
if [[ -n $CI ]]; then
23-
if [[ -z $CI_PULL_REQUEST ]]; then
25+
if [[ -n $PUBLISH_DOCS ]]; then
2426
./publish-docs.sh
25-
fi
2627
fi

0 commit comments

Comments
 (0)