From e637fe055a6c7a133298e69272f9dfe900ef968d Mon Sep 17 00:00:00 2001 From: Christoph Witzko Date: Thu, 12 Nov 2020 22:11:18 +0100 Subject: [PATCH] feat: add changelog to outputs --- action.yml | 2 ++ dist/index.js | 9 ++++----- src/index.js | 9 ++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/action.yml b/action.yml index 18d3d42..4b40b65 100644 --- a/action.yml +++ b/action.yml @@ -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' diff --git a/dist/index.js b/dist/index.js index 9321530..019e83b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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')) @@ -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') } @@ -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}`) diff --git a/src/index.js b/src/index.js index 44cb0ce..a118e9d 100644 --- a/src/index.js +++ b/src/index.js @@ -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')) @@ -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') } @@ -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}`)