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

ci: Harden docs publish to only run with a vercel token #3389

Merged
merged 1 commit into from
Jul 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions docs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ cd "$(dirname "$0")"
# shellcheck source=ci/env.sh
source ../ci/env.sh

# Publish only from merge commits and release tags
if [[ -n $CI ]]; then
if [[ -z $CI_PULL_REQUEST ]]; then
npm install --global docusaurus-init
docusaurus-init
npm install --global vercel
fi
# Publish only if in CI, vercel token is present, and it's not a pull request
if [[ -n $CI ]] && [[ -n $VERCEL_TOKEN ]] && [[ -z $CI_PULL_REQUEST ]]; then
PUBLISH_DOCS=true
else
PUBLISH_DOCS=
fi

if [[ -n $PUBLISH_DOCS ]]; then
npm install --global docusaurus-init
docusaurus-init
npm install --global vercel
fi

# Build from /src into /build
npm run build

# Publish only from merge commits and release tags
if [[ -n $CI ]]; then
if [[ -z $CI_PULL_REQUEST ]]; then
if [[ -n $PUBLISH_DOCS ]]; then
./publish-docs.sh
fi
fi