Skip to content

Commit

Permalink
build: adjust ci
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Feb 19, 2020
1 parent 908d7e5 commit d86c5c0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions build/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ if (CI && (GITHUB_REF !== 'refs/heads/master' || GITHUB_EVENT_NAME !== 'push'))
const headerMap = {
feat: 'Features',
fix: 'Bug Fixes',
dep: 'Dependencies',
}

const prefixes = Object.keys(headerMap)
const prefixRegExp = new RegExp(`^(${prefixes.join('|')})(?:\\((\\S+)\\))?: (.+)$`)

;(async () => {
let folders = await getWorkspaces()
if (process.argv[2]) {
Expand Down Expand Up @@ -60,15 +64,16 @@ const headerMap = {
return console.log(`Tag ${version} already exists.`)
}

const updates = { fix: '', feat: '' }
const updates = {}
const lastTag = tags[tags.length - 1]
const commits = spawnSync(`git log ${lastTag}..HEAD --format=%H%s`).split(/\r?\n/).reverse()
for (const commit of commits) {
const hash = commit.slice(0, 40)
const details = /^(fix|feat)(?:\((\S+)\))?: (.+)$/.exec(commit.slice(40))
const details = prefixRegExp.exec(commit.slice(40))
if (!details) continue
let message = details[3]
if (details[2]) message = `**${details[2]}:** ${message}`
if (!updates[details[1]]) updates[details[1]] = ''
updates[details[1]] += `- ${message} (${hash})\n`
}

Expand Down

0 comments on commit d86c5c0

Please sign in to comment.