Skip to content

Commit

Permalink
Merge pull request #187 from codfish/more-outputs
Browse files Browse the repository at this point in the history
feat: add type, channel, gitHead, gitTag, name outputs
  • Loading branch information
codfish committed Apr 2, 2023
2 parents dcd1875 + bebedee commit 7852422
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 16 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/release.yml
Expand Up @@ -34,16 +34,25 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: test output
if: steps.semantic.outputs.new-release-published == 'true'
- name: Dump semantic outputs
if: steps.semantic-dry-run.outputs.new-release-published == 'true'
run: |
echo "$OUTPUTS"
echo "$NEW_RELEASE_PUBLISHED"
echo "$RELEASE_MAJOR"
echo "$RELEASE_MINOR"
echo "$RELEASE_PATCH"
echo "Outputs:\n"
echo "$SEMANTIC_OUTPUTS"
echo "\n-----\n\nEnvironment Variables:\n"
echo "NEW_RELEASE_PUBLISHED: $NEW_RELEASE_PUBLISHED"
echo "RELEASE_VERSION: $RELEASE_VERSION"
echo "RELEASE_MAJOR: $RELEASE_MAJOR"
echo "RELEASE_MINOR: $RELEASE_MINOR"
echo "RELEASE_PATCH: $RELEASE_PATCH"
echo "RELEASE_NOTES: $RELEASE_NOTES"
echo "RELEASE_TYPE: $RELEASE_TYPE"
echo "RELEASE_CHANNEL: $RELEASE_CHANNEL"
echo "RELEASE_GIT_HEAD: $RELEASE_GIT_HEAD"
echo "RELEASE_GIT_TAG: $RELEASE_GIT_TAG"
echo "RELEASE_NAME: $RELEASE_NAME"
env:
OUTPUTS: ${{ toJson(steps.semantic.outputs) }}
SEMANTIC_OUTPUTS: ${{ toJson(steps.semantic-dry-run.outputs) }}

- name: docker login
run: |
Expand Down
14 changes: 12 additions & 2 deletions README.md
Expand Up @@ -286,7 +286,7 @@ might be so this is a way to cover more cases.

**Docs:** https://help.github.com/en/articles/metadata-syntax-for-github-actions#outputs

**Output Variables**:
#### Output Variables

| Output Variable | Description |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -296,8 +296,13 @@ might be so this is a way to cover more cases.
| release-minor | The new releases' minor version number, i.e. `8` |
| release-patch | The new releases' patch version number, i.e. `3` |
| release-notes | The release notes of the next release. |
| type | The semver export type of the release, e.g. `major`, `prerelease`, etc. |
| channel | The release channel of the release. |
| git-head | The git hash of the release. |
| git-tag | The version with v prefix. |
| name | The release name. |

**Environment Variables**:
#### Environment Variables

| Environment Variable | Description |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -307,6 +312,11 @@ might be so this is a way to cover more cases.
| RELEASE_MINOR | The new releases' minor version number, i.e. `8` |
| RELEASE_PATCH | The new releases' patch version number, i.e. `3` |
| RELEASE_NOTES | The release notes of the next release in markdown. |
| RELEASE_TYPE | The semver export type of the release, e.g. `major`, `prerelease`, etc. |
| RELEASE_CHANNEL | The release channel of the release. |
| RELEASE_GIT_HEAD | The git hash of the release. |
| RELEASE_GIT_TAG | The version with v prefix. |
| RELEASE_NAME | The release name. |

## Maintenance

Expand Down
22 changes: 17 additions & 5 deletions action.yml
Expand Up @@ -56,15 +56,27 @@ inputs:
outputs:
new-release-published:
description:
"Either `'true'` when a new release was published or `'false'` when no release was published"
"Either `'true'` when a new release was published or `'false'` when no release was published."
release-version:
description: "The new releases' semantic version, i.e. `1.8.3`"
description: "The new releases' semantic version, i.e. `1.8.3`."
release-major:
description: "The new releases' major version number, i.e. `1`"
description: "The new releases' major version number, i.e. `1`."
release-minor:
description: "The new releases' minor version number, i.e. `8`"
description: "The new releases' minor version number, i.e. `8`."
release-patch:
description: "The new releases' patch version number, i.e. `3`"
description: "The new releases' patch version number, i.e. `3`."
release-notes:
description: "The release notes of the next release."
type:
description: "The semver export type of the release, e.g. `major`, `prerelease`, etc."
channel:
description: "The release channel of the release."
git-head:
description: "The git hash of the release."
git-tag:
description: "The version with v prefix."
name:
description: "The release name."
runs:
using: 'docker'
image: 'Dockerfile'
12 changes: 11 additions & 1 deletion entrypoint.js
Expand Up @@ -112,20 +112,30 @@ async function run() {
}

// set outputs
const { version, notes } = nextRelease;
const { version, notes, type, channel, gitHead, gitTag, name } = nextRelease;
const [major, minor, patch] = version.split('.');
core.exportVariable('NEW_RELEASE_PUBLISHED', 'true');
core.exportVariable('RELEASE_VERSION', version);
core.exportVariable('RELEASE_MAJOR', major);
core.exportVariable('RELEASE_MINOR', minor);
core.exportVariable('RELEASE_PATCH', patch);
core.exportVariable('RELEASE_NOTES', notes);
core.exportVariable('RELEASE_TYPE', type);
core.exportVariable('RELEASE_CHANNEL', channel);
core.exportVariable('RELEASE_GIT_HEAD', gitHead);
core.exportVariable('RELEASE_GIT_TAG', gitTag);
core.exportVariable('RELEASE_NAME', name);
core.setOutput('new-release-published', 'true');
core.setOutput('release-version', version);
core.setOutput('release-major', major);
core.setOutput('release-minor', minor);
core.setOutput('release-patch', patch);
core.setOutput('release-notes', notes);
core.setOutput('type', type);
core.setOutput('channel', channel);
core.setOutput('git-head', gitHead);
core.setOutput('git-tag', gitTag);
core.setOutput('name', name);
}

run().catch(core.setFailed);

0 comments on commit 7852422

Please sign in to comment.