-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
29 lines (23 loc) · 991 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import core from '@actions/core'
import github from '@actions/github'
import sr from 'semantic-release'
import ca from '@semantic-release/commit-analyzer'
import rng from '@semantic-release/release-notes-generator'
;(async function() {
const config = {
branches: core.getInput('branches').split('\n').map(branch => {
return branch.startsWith('{ ') ? JSON.parse(branch) : branch
}),
plugins: core.getInput('plugins').split('\n'),
tagFormat: core.getInput('tagFormat'),
}
console.log('Configuration', config)
const result = await sr(config)
if (!result) throw new Error('No release happened')
core.setOutput('version', result.nextRelease.version)
core.setOutput('notes', result.nextRelease.notes)
core.setOutput('type', result.nextRelease.type)
core.setOutput('tag', result.nextRelease.gitTag)
core.setOutput('channel', result.nextRelease.channel)
core.setOutput('name', result.nextRelease.name)
})().catch(err => core.setFailed(err.message))