ci: Harden docs publish to only run with a vercel token (#3389)
This commit is contained in:
parent
827176ed84
commit
fb46b9a115
|
@ -6,21 +6,22 @@ cd "$(dirname "$0")"
|
||||||
# shellcheck source=ci/env.sh
|
# shellcheck source=ci/env.sh
|
||||||
source ../ci/env.sh
|
source ../ci/env.sh
|
||||||
|
|
||||||
# Publish only from merge commits and release tags
|
# Publish only if in CI, vercel token is present, and it's not a pull request
|
||||||
if [[ -n $CI ]]; then
|
if [[ -n $CI ]] && [[ -n $VERCEL_TOKEN ]] && [[ -z $CI_PULL_REQUEST ]]; then
|
||||||
if [[ -z $CI_PULL_REQUEST ]]; then
|
PUBLISH_DOCS=true
|
||||||
|
else
|
||||||
|
PUBLISH_DOCS=
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $PUBLISH_DOCS ]]; then
|
||||||
npm install --global docusaurus-init
|
npm install --global docusaurus-init
|
||||||
docusaurus-init
|
docusaurus-init
|
||||||
npm install --global vercel
|
npm install --global vercel
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Build from /src into /build
|
# Build from /src into /build
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
# Publish only from merge commits and release tags
|
if [[ -n $PUBLISH_DOCS ]]; then
|
||||||
if [[ -n $CI ]]; then
|
|
||||||
if [[ -z $CI_PULL_REQUEST ]]; then
|
|
||||||
./publish-docs.sh
|
./publish-docs.sh
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
Loading…
Reference in New Issue