Skip to content

Commit

Permalink
improve docs publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Sep 12, 2018
1 parent 9e718bc commit 2a13309
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 24 deletions.
64 changes: 40 additions & 24 deletions .circleci/deploy-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,48 @@ fi

export changedFiles=$(git diff-tree --no-commit-id --name-only -r $lastCommits)

if [[ "$changedFiles" = *"docs/"* ]]; then
echo "There were changes in the docs folder. Going to deploy docs"
if [ "$changedFiles" = *"docs/1.0/"* ] || \
[ "$changedFiles" = *"docs/1.1/"* ] || \
[ "$changedFiles" = *"docs/1.2/"* ] || \
[ "$changedFiles" = *"docs/1.3/"* ] || \
[ "$changedFiles" = *"docs/1.4/"* ] || \
[ "$changedFiles" = *"docs/1.5/"* ] || \
[ "$changedFiles" = *"docs/1.6/"* ] || \
[ "$changedFiles" = *"docs/1.7/"* ] || \
[ "$changedFiles" = *"docs/1.8/"* ] || \
[ "$changedFiles" = *"docs/1.9/"* ] || \
[ "$changedFiles" = *"docs/1.10/"* ] || \
[ "$changedFiles" = *"docs/1.11/"* ] || \
[ "$changedFiles" = *"docs/1.12/"* ] || \
[ "$changedFiles" = *"docs/1.13/"* ] || \
[ "$changedFiles" = *"docs/1.14/"* ]
then
echo "There were changes in the old docs. Going to deploy old docs"

if [ ! -z "$CIRCLE_BRANCH" ]; then
UPPER_BRANCH="MASTER"
PAT_GREEN_FROM_BRANCH="PAT_GREEN_${UPPER_BRANCH}"
PAT_GREEN=${!PAT_GREEN_FROM_BRANCH:?$PAT_GREEN_FROM_BRANCH env var not set}
PAT_BLUE_FROM_BRANCH="PAT_BLUE_${UPPER_BRANCH}"
PAT_BLUE=${!PAT_BLUE_FROM_BRANCH:?$PAT_BLUE_FROM_BRANCH env var not set}
fi

BRANCH="${CIRCLE_BRANCH:-dev}"

export PAT_BLUE="${PAT_BLUE:?PAT_BLUE env variable not set}"
export PAT_GREEN="${PAT_GREEN:?PAT_GREEN env variable not set}"
export BLUE_ID="${BLUE_ID:?BLUE_ID env variable not set}"
export GREEN_ID="${GREEN_ID:?GREEN_ID env variable not set}"
export SYSTEM_AUTH_TOKEN="${SYSTEM_AUTH_TOKEN:?SYSTEM_AUTH_TOKEN env variable not set}"

docs-cli -c ./docs

curl -X POST -d '' $NETLIFY_HOOK
elif [ "$changedFiles" = *"docs/"* ]
echo "Deploying new docs"
curl -X POST -d '' $NETLIFY_HOOK_DOCS_V2
else
echo "No Changes. Exiting"
exit 0
fi


if [ ! -z "$CIRCLE_BRANCH" ]; then
UPPER_BRANCH="MASTER"
PAT_GREEN_FROM_BRANCH="PAT_GREEN_${UPPER_BRANCH}"
PAT_GREEN=${!PAT_GREEN_FROM_BRANCH:?$PAT_GREEN_FROM_BRANCH env var not set}
PAT_BLUE_FROM_BRANCH="PAT_BLUE_${UPPER_BRANCH}"
PAT_BLUE=${!PAT_BLUE_FROM_BRANCH:?$PAT_BLUE_FROM_BRANCH env var not set}
fi


BRANCH="${CIRCLE_BRANCH:-dev}"

export PAT_BLUE="${PAT_BLUE:?PAT_BLUE env variable not set}"
export PAT_GREEN="${PAT_GREEN:?PAT_GREEN env variable not set}"
export BLUE_ID="${BLUE_ID:?BLUE_ID env variable not set}"
export GREEN_ID="${GREEN_ID:?GREEN_ID env variable not set}"
export SYSTEM_AUTH_TOKEN="${SYSTEM_AUTH_TOKEN:?SYSTEM_AUTH_TOKEN env variable not set}"

docs-cli -c ./docs

curl -X POST -d '' $NETLIFY_HOOK
curl -X POST -d '' $NETLIFY_HOOK_DOCS_V2
1 change: 1 addition & 0 deletions docs/1.17/prisma-client/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ The Prisma client is an auto-generated library that connects to your Prisma serv
| **Check Existence** ([JS](https://www.prisma.io/docs/prisma-client/api-reference/check-existence-JAVASCRIPT-pyl1/) - [TS](https://www.prisma.io/docs/1.17/prisma-client/api-reference/check-existence-TYPESCRIPT-pyl2/) - [Go](https://www.prisma.io/docs/1.17/prisma-client/api-reference/check-existence-GO-go01/)) | Learn whether a certain record exists in th databse using Prisma client |
| **Schema Delegation** ([JS](https://www.prisma.io/docs/prisma-client/api-reference/schema-delegation-JAVASCRIPT-pyl7/) - [TS](https://www.prisma.io/docs/1.17/prisma-client/api-reference/schema-delegation-TYPESCRIPT-pyl8/) - [Go](https://www.prisma.io/docs/1.17/prisma-client/api-reference/schema-delegation-GO-go07/)) | Learn how to do schema delegation inside resolverrs using Prisma client |


0 comments on commit 2a13309

Please sign in to comment.