Skip to content

Commit

Permalink
feat: add changelog to outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
christophwitzko committed Nov 12, 2020
1 parent 23103d3 commit e637fe0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ outputs:
description: 'the patch version of the created release'
version_prerelease:
description: 'the prerelease version of the created release'
changelog:
description: 'the generated release changelog'
runs:
using: 'node12'
main: 'dist/index.js'
9 changes: 4 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5157,7 +5157,8 @@ async function installer (version) {

async function main () {
try {
const args = ['--version-file']
const changelogFile = core.getInput('changelog-file') || '.generated-go-semantic-release-changelog.md'
const args = ['--version-file', '--changelog', changelogFile]
if (core.getInput('github-token')) {
args.push('--token')
args.push(core.getInput('github-token'))
Expand All @@ -5172,10 +5173,6 @@ async function main () {
args.push('--update')
args.push(core.getInput('update-file'))
}
if (core.getInput('changelog-file')) {
args.push('--changelog')
args.push(core.getInput('changelog-file'))
}
if (core.getInput('ghr')) {
args.push('--ghr')
}
Expand All @@ -5193,9 +5190,11 @@ async function main () {
core.setFailed(error.message)
return
}
const generatedChangelog = (await fs.readFile(changelogFile)).toString('utf8')
const version = (await fs.readFile('.version')).toString('utf8')
await fs.unlink('.version')
const parsedVersion = new SemVer(version)
core.setOutput('changelog', generatedChangelog)
core.debug(`setting version to ${parsedVersion.version}`)
core.setOutput('version', parsedVersion.version)
core.setOutput('version_major', `${parsedVersion.major}`)
Expand Down
9 changes: 4 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ async function installer (version) {

async function main () {
try {
const args = ['--version-file']
const changelogFile = core.getInput('changelog-file') || '.generated-go-semantic-release-changelog.md'
const args = ['--version-file', '--changelog', changelogFile]
if (core.getInput('github-token')) {
args.push('--token')
args.push(core.getInput('github-token'))
Expand All @@ -42,10 +43,6 @@ async function main () {
args.push('--update')
args.push(core.getInput('update-file'))
}
if (core.getInput('changelog-file')) {
args.push('--changelog')
args.push(core.getInput('changelog-file'))
}
if (core.getInput('ghr')) {
args.push('--ghr')
}
Expand All @@ -63,9 +60,11 @@ async function main () {
core.setFailed(error.message)
return
}
const generatedChangelog = (await fs.readFile(changelogFile)).toString('utf8')
const version = (await fs.readFile('.version')).toString('utf8')
await fs.unlink('.version')
const parsedVersion = new SemVer(version)
core.setOutput('changelog', generatedChangelog)
core.debug(`setting version to ${parsedVersion.version}`)
core.setOutput('version', parsedVersion.version)
core.setOutput('version_major', `${parsedVersion.major}`)
Expand Down

0 comments on commit e637fe0

Please sign in to comment.