5
0
Fork 0
mirror of https://github.com/cycjimmy/semantic-release-action.git synced 2025-11-14 14:03:47 +00:00

fix: added gitHead and gitTag outputs

This commit is contained in:
Dan Hunt 2022-10-27 12:02:29 -04:00
parent 5982a02995
commit 271f228b09
4 changed files with 23 additions and 3 deletions

View file

@ -234,7 +234,11 @@ steps:
| new_release_patch_version | Patch version of the new release. (e.g. `0`) | | new_release_patch_version | Patch version of the new release. (e.g. `0`) |
| new_release_channel | The distribution channel on which the last release was initially made available (undefined for the default distribution channel). | | new_release_channel | The distribution channel on which the last release was initially made available (undefined for the default distribution channel). |
| new_release_notes | The release notes for the new release. | | new_release_notes | The release notes for the new release. |
| new_release_git_head | The sha of the last commit being part of the new release |
| new_release_git_tag | The Git tag associated with the new release. |
| last_release_version | Version of the previous release, if there was one. (e.g. `1.2.0`) | | last_release_version | Version of the previous release, if there was one. (e.g. `1.2.0`) |
| last_release_git_head | The sha of the last commit being part of the last release, if there was one. |
| last_release_git_tag | The Git tag associated with the last release, if there was one. |
#### Using Output Variables: #### Using Output Variables:
```yaml ```yaml

View file

@ -41,8 +41,16 @@ outputs:
description: 'The distribution channel on which the last release was initially made available (undefined for the default distribution channel).' description: 'The distribution channel on which the last release was initially made available (undefined for the default distribution channel).'
new_release_notes: new_release_notes:
description: 'The release notes for the new release.' description: 'The release notes for the new release.'
new_release_git_head:
description: 'The sha of the last commit being part of the new release.'
new_release_git_tag:
description: 'The Git tag associated with the new release.'
last_release_version: last_release_version:
description: 'Version of the previous release, if there was one.' description: 'Version of the previous release, if there was one.'
last_release_git_head:
description: 'The sha of the last commit being part of the last release, if there was one.'
last_release_git_tag:
description: 'The Git tag associated with the last release, if there was one.'
runs: runs:
using: 'node12' using: 'node12'
main: 'index.js' main: 'index.js'

View file

@ -6,5 +6,9 @@
"new_release_patch_version": "new_release_patch_version", "new_release_patch_version": "new_release_patch_version",
"new_release_channel": "new_release_channel", "new_release_channel": "new_release_channel",
"new_release_notes": "new_release_notes", "new_release_notes": "new_release_notes",
"last_release_version": "last_release_version" "new_release_git_head": "new_release_git_head",
"new_release_git_tag": "new_release_git_tag",
"last_release_version": "last_release_version",
"last_release_git_head": "last_release_git_head",
"last_release_git_tag": "last_release_git_tag"
} }

View file

@ -29,7 +29,7 @@ module.exports = async (result) => {
core.debug(`The release was published with plugin "${release.pluginName}".`); core.debug(`The release was published with plugin "${release.pluginName}".`);
} }
const {version, channel, notes} = nextRelease; const {version, channel, notes, gitHead, gitTag} = nextRelease;
const [major, minor, patch] = version.split(/\.|-|\s/g, 3); const [major, minor, patch] = version.split(/\.|-|\s/g, 3);
// set outputs // set outputs
@ -40,5 +40,9 @@ module.exports = async (result) => {
core.setOutput(outputs.new_release_patch_version, patch); core.setOutput(outputs.new_release_patch_version, patch);
core.setOutput(outputs.new_release_channel, channel); core.setOutput(outputs.new_release_channel, channel);
core.setOutput(outputs.new_release_notes, notes); core.setOutput(outputs.new_release_notes, notes);
core.setOutput(outputs.last_release_version, lastRelease.version) core.setOutput(outputs.new_release_git_head, gitHead);
core.setOutput(outputs.new_release_git_tag, gitTag);
core.setOutput(outputs.last_release_version, lastRelease.version);
core.setOutput(outputs.last_release_git_head, lastRelease.gitHead);
core.setOutput(outputs.last_release_git_tag, lastRelease.gitTag);
}; };