2019-01-26 23:00:32 +00:00
|
|
|
#!/usr/bin/env node
|
2019-01-26 22:29:58 +00:00
|
|
|
const fs = require('fs')
|
2019-01-26 23:22:12 +00:00
|
|
|
const { execSync } = require('child_process')
|
2019-01-26 23:31:18 +00:00
|
|
|
/*
|
2019-01-26 23:22:12 +00:00
|
|
|
const event = JSON.parse(fs.readFileSync('/github/workflow/event.json').toString())
|
|
|
|
|
|
|
|
let messages = event.commits.map(commit => commit.message)
|
|
|
|
|
|
|
|
let version = 'patch'
|
|
|
|
if (messages.map(message => message.includes('BREAKING CHANGE')).includes(true)) {
|
|
|
|
version = 'major'
|
|
|
|
} else if (messages.map(message => message.toLowerCase().startsWith('feat')).includes(true)) {
|
|
|
|
version = 'minor'
|
2019-01-26 23:31:18 +00:00
|
|
|
} */
|
2019-01-26 23:22:12 +00:00
|
|
|
|
2019-01-26 23:31:18 +00:00
|
|
|
let version = 'patch'
|
|
|
|
|
|
|
|
let pkg = require('./package.json')
|
|
|
|
let current = execSync(`npm view ${pkg.name} version`).toString()
|
2019-01-26 23:39:45 +00:00
|
|
|
process.stdout.write(execSync(`npm version --allow-same-version --git-tag-version ${current} `))
|
|
|
|
process.stdout.write(execSync(`npm version --git-tag-version ${version}`))
|
2019-01-26 23:22:12 +00:00
|
|
|
process.stdout.write(execSync(`npm publish --access=public`))
|
|
|
|
process.stdout.write(execSync(`git push --tags`))
|
|
|
|
|
|
|
|
// npm version minor && npm publish --access=public && git push --tags
|