Skip to content

Commit

Permalink
Merge branch 'master' into key-members-validation
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwittwer authored Oct 26, 2018
2 parents cf9fed8 + 9785fe7 commit ae5f642
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 35 deletions.
3 changes: 0 additions & 3 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
branch: master
publishConfig:
# FIXME this does not work
tag: next
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ language: node_js
node_js:
- lts/*

branches:
only:
- master
- /^greenkeeper/.*$/

cache:
directories:
- $HOME/.npm
Expand Down
65 changes: 38 additions & 27 deletions tools/gh-pages-publish.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,42 @@
const { cd, exec, echo, touch } = require("shelljs")
const { readFileSync } = require("fs")
const url = require("url")
const { cd, exec, echo, touch } = require('shelljs')
const { readFileSync } = require('fs')
const url = require('url')

let repoUrl
let pkg = JSON.parse(readFileSync("package.json") as any)
if (typeof pkg.repository === "object") {
if (!pkg.repository.hasOwnProperty("url")) {
throw new Error("URL does not exist in repository section")
}
repoUrl = pkg.repository.url
} else {
repoUrl = pkg.repository
const info = {
TRAVIS_BRANCH: process.env.TRAVIS_BRANCH,
TRAVIS_PULL_REQUEST: process.env.TRAVIS_PULL_REQUEST,
TRAVIS_PULL_REQUEST_BRANCH: process.env.TRAVIS_PULL_REQUEST_BRANCH,
}
echo(`running on branch ${JSON.stringify(info)}`)

if (info.TRAVIS_BRANCH === 'master' && info.TRAVIS_PULL_REQUEST === 'false') {
const pkg = JSON.parse(readFileSync('package.json') as any)
let repoUrl
if (typeof pkg.repository === 'object') {
if (!pkg.repository.hasOwnProperty('url')) {
throw new Error('URL does not exist in repository section')
}
repoUrl = pkg.repository.url
} else {
repoUrl = pkg.repository
}

let parsedUrl = url.parse(repoUrl)
let repository = (parsedUrl.host || "") + (parsedUrl.path || "")
let ghToken = process.env.GH_TOKEN
const parsedUrl = url.parse(repoUrl)
const repository = (parsedUrl.host || '') + (parsedUrl.path || '')
const ghToken = process.env.GH_TOKEN

echo("Deploying docs!!!")
cd("dist/docs")
touch(".nojekyll")
exec("git init")
exec("git add .")
exec('git config user.name "Michael Wittwer"')
exec('git config user.email "[email protected]"')
exec('git commit -m "docs(docs): update gh-pages"')
exec(
`git push --force --quiet "https://${ghToken}@${repository}" master:gh-pages`
)
echo("Docs deployed!!")
echo('Deploying docs!!!')
cd('dist/docs')
touch('.nojekyll')
exec('git init')
exec('git add .')
exec('git config user.name "Michael Wittwer"')
exec('git config user.email "[email protected]"')
exec('git commit -m "docs(docs): update gh-pages"')
exec(
`git push --force --quiet "https://${ghToken}@${repository}" master:gh-pages`
)
echo('Docs deployed!!')
} else {
echo('Not running on master -> skipping docs deployment')
}

0 comments on commit ae5f642

Please sign in to comment.