Skip to content

Commit

Permalink
ci: update documentation after publishing a release
Browse files Browse the repository at this point in the history
  • Loading branch information
devoto13 committed May 23, 2020
1 parent c22c297 commit 2122dc7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions .npmignore
Expand Up @@ -4,6 +4,7 @@
tmp
test
tasks
/tools/
docs
client
logo
Expand Down
3 changes: 2 additions & 1 deletion release.config.js
Expand Up @@ -17,6 +17,7 @@ module.exports = {
'@semantic-release/github'
],
success: [
'@semantic-release/github'
'@semantic-release/github',
'./tools/update-docs'
]
}
20 changes: 20 additions & 0 deletions tools/update-docs.js
@@ -0,0 +1,20 @@
const { execSync } = require('child_process')
const { dirSync } = require('tmp')

const success = async (pluginConfig, { nextRelease, logger }) => {
const [major, minor] = nextRelease.version.split('.')
const docsVersion = `${major}.${minor}`

const { name: docsPath } = dirSync()

const repoOrigin = `https://${process.env.GH_TOKEN}@github.com/karma/karma-runner.github.com.git`

const options = { encoding: 'utf8', cwd: docsPath }

logger.log(execSync(`git clone ${repoOrigin} .`, options))
logger.log(execSync('npm ci', options))
logger.log(execSync(`./sync-docs.sh "${nextRelease.gitTag}" "${docsVersion}"`, options))
logger.log(execSync('git push origin master', options))
}

module.exports = { success }

0 comments on commit 2122dc7

Please sign in to comment.