Description
Current GitHub action has some inputs, then it does something, but it has not usable outputs to check what the results were.
As a user of the GitHub action, i want several outputs, so that i can use them programmatically in GitHub workflows.
- released: bool(-ish) value that indicates whether a released happened
- version: (new) semantic version that was calculated. if
released was false than this would be the current version detected.
- tag: VCS tag-name was used for the release. if
released was false than this would be empty string.
- url: Github.com URL for the release. if
released is false, then this value is empty string
- id: Release ID. if
released is false, then this value is null
- assets: JSON array containing information about each uploaded asset, in the format given here (minus the uploader field). if
released is false, then this value is an empty JSON list
- assets-dist: JSON object containing information about each uploaded dist asset, in the format given here (minus the uploader field). if
released is false, then this value is an empty JSON object
- upload_url: URL for uploading assets to the release. if
released is false, then this value is an empty string
output inspired by https://github.com/softprops/action-gh-release
Use cases
- released: python-semantic-release GitHub action might detect that no release should happen. To indicate this, you can check this value. As an example, you can use
${{ steps.<step-id>.outputs.released }} to check if a release happened and control other steps based on that information. For example, a DockerHub release can be skipped, if python-semantic-release did not happen, although the GitHub action ended with success() state.
- version: As an example, you can use
${{ steps.<step-id>.outputs.version }} to get the version that was currently detected/used for the release.
- tag: As an example, you can use
${{ steps.<step-id>.outputs.tag }} as an input for https://github.com/marketplace/actions/upload-files-to-a-github-release
- assets: As an example, you can use
${{ fromJSON(steps.<step-id>.outputs.assets-dist)[0].browser_download_url }} to get the download URL of the first asset. This file can then be downloaded and put in a docker image.
- asset-dist: As an example, you can use
${{ fromJSON(steps.<step-id>.outputs.assets-dist).wheel.browser_download_url }} to get the download URL of the wheel-dist asset. This file can then be downloaded and put in a docker image.
- upload_url: As an example, you can use
${{ steps.<step-id>.outputs.upload_url }} as an input for https://github.com/actions/upload-release-asset
Possible implementation
Description
Current GitHub action has some inputs, then it does something, but it has not usable outputs to check what the results were.
As a user of the GitHub action, i want several outputs, so that i can use them programmatically in GitHub workflows.
releasedwasfalsethan this would be the current version detected.releasedwasfalsethan this would be empty string.releasedisfalse, then this value is empty stringreleasedisfalse, then this value isnullreleasedisfalse, then this value is an empty JSON listreleasedisfalse, then this value is an empty JSON objectreleasedisfalse, then this value is an empty stringoutput inspired by https://github.com/softprops/action-gh-release
Use cases
${{ steps.<step-id>.outputs.released }}to check if a release happened and control other steps based on that information. For example, a DockerHub release can be skipped, if python-semantic-release did not happen, although the GitHub action ended withsuccess()state.${{ steps.<step-id>.outputs.version }}to get the version that was currently detected/used for the release.${{ steps.<step-id>.outputs.tag }}as an input for https://github.com/marketplace/actions/upload-files-to-a-github-release${{ fromJSON(steps.<step-id>.outputs.assets-dist)[0].browser_download_url }}to get the download URL of the first asset. This file can then be downloaded and put in a docker image.${{ fromJSON(steps.<step-id>.outputs.assets-dist).wheel.browser_download_url }}to get the download URL of the wheel-dist asset. This file can then be downloaded and put in a docker image.${{ steps.<step-id>.outputs.upload_url }}as an input for https://github.com/actions/upload-release-assetPossible implementation
ala
print('::set-output name=version::1.2.3')- maybe there is a lib for that, or the sanitizers can be copied from https://github.com/actions/toolkit/blob/daf8bb00606d37ee2431d9b1596b88513dcf9c59/packages/core/src/command.ts#L80-L94releasedshould be booleantrue/`` so it is usable in expressionsTherefore, it seems like GitHub expression treats every non-empty string as true and empty string as false.
/usr/bin/docker run .... -e GITHUB_ACTIONS=true -e CI=true ....