Skip to content

Commit

Permalink
chore(build): adds more reliable now deploy script (uber#832)
Browse files Browse the repository at this point in the history
* feat: adds safer now deploy script

* fix: adds the master branch filter
  • Loading branch information
chasestarr authored Feb 1, 2019
1 parent 5182de7 commit 5eb983c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ steps:
agents:
queue: workers
- name: ':now:'
branches: 'v*.*.*'
command: yarn documentation:build && yarn now --team=baseui --token=${ZEIT_NOW_TOKEN} && yarn now alias --team=baseui --token=${ZEIT_NOW_TOKEN}
branches: 'master'
command: ./scripts/now-deploy.sh
plugins:
'docker-compose':
run: baseui
agents:
queue: workers
- name: ':screener:'
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,6 @@ services:
- BUILDKITE_BUILD_URL
- BUILDKITE_PROJECT_SLUG
- BUILDKITE_COMMIT
- GITHUB_AUTH_TOKEN
- SCREENER_API_KEY
- ZEIT_NOW_TOKEN
22 changes: 22 additions & 0 deletions scripts/now-deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -e

# apt-get install -y jq

this_commit=$(echo $BUILDKITE_COMMIT | tr -d '"')
tags=$(curl https://api.github.com/repos/uber-web/baseui/git/refs/tags?access_token=${GITHUB_AUTH_TOKEN})
latest_tagged_commit=$(echo $tags | jq '.[-1].object.sha' | tr -d '"')

if [ "$this_commit" = "$latest_tagged_commit" ]; then
echo current commit matches latest tagged commit
echo deploying to now...

yarn documentation:build &&
yarn now --team=baseui --token=$ZEIT_NOW_TOKEN &&
yarn now alias --team=baseui --token=$ZEIT_NOW_TOKEN &&
yarn now rm baseui-documentation --safe --team=baseui --token=$ZEIT_NOW_TOKEN --yes
else
echo current commit does not match latest tagged commit
echo exited without deploying to now
fi

0 comments on commit 5eb983c

Please sign in to comment.