diff --git a/.releaserc.yml b/.releaserc.yml index ab8ecdf82..77a74f108 100644 --- a/.releaserc.yml +++ b/.releaserc.yml @@ -1,4 +1 @@ branch: master -publishConfig: -# FIXME this does not work - tag: next diff --git a/.travis.yml b/.travis.yml index f2b72f021..4f2803bb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,11 +2,6 @@ language: node_js node_js: - lts/* -branches: - only: - - master - - /^greenkeeper/.*$/ - cache: directories: - $HOME/.npm diff --git a/tools/gh-pages-publish.ts b/tools/gh-pages-publish.ts index 879bee26c..5ca9dc1cc 100644 --- a/tools/gh-pages-publish.ts +++ b/tools/gh-pages-publish.ts @@ -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 "michael.wittwer@shiftcode.ch"') -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 "michael.wittwer@shiftcode.ch"') + 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') +}