Skip to content

Commit

Permalink
chore(ci): ensure correct now deployment is aliased
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelWD authored and johnleider committed Feb 15, 2019
1 parent 88d6cc2 commit 8d1cee1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 29 deletions.
15 changes: 3 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,14 @@ jobs:
- stage: publish-docs-live
name: 'Publish docs - live'
before_script: yarn global add now
script:
- node scripts/set-now-alias.js vuetifyjs.com
- now --team=vuetifyjs --token=$NOW_TOKEN --npm
- now alias --team=vuetifyjs --token=$NOW_TOKEN
script: node scripts/deploy-and-alias.js vuetifyjs.com

- stage: publish-docs-dev
name: 'Publish docs - dev'
before_script: yarn global add now
script:
- node scripts/set-now-alias.js dev.vuetifyjs.com
- now --team=vuetifyjs --token=$NOW_TOKEN --npm
- now alias --team=vuetifyjs --token=$NOW_TOKEN
script: node scripts/deploy-and-alias.js dev.vuetifyjs.com

- stage: publish-docs-next
name: 'Publish docs - next'
before_script: yarn global add now
script:
- node scripts/set-now-alias.js next.vuetifyjs.com
- now --team=vuetifyjs --token=$NOW_TOKEN --npm
- now alias --team=vuetifyjs --token=$NOW_TOKEN
script: node scripts/deploy-and-alias.js next.vuetifyjs.com
3 changes: 2 additions & 1 deletion now.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"github": {
"autoAlias": false,
"silent": true
}
},
"version": 1
}
20 changes: 20 additions & 0 deletions scripts/deploy-and-alias.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const shell = require('shelljs')

const alias = process.argv[2]

if (!alias) {
console.error('Alias not defined')
process.exit(1)
}

const options = {
env: process.env
}

const child = shell.exec('now --team=vuetifyjs --token=$NOW_TOKEN --npm', options)
if (child.code !== 0) {
process.exit(child.code)
}
const instanceUrl = child.stdout

shell.exec(`now alias set ${instanceUrl} ${alias} --team=vuetifyjs --token=$NOW_TOKEN`, options)
16 changes: 0 additions & 16 deletions scripts/set-now-alias.js

This file was deleted.

0 comments on commit 8d1cee1

Please sign in to comment.