diff --git a/CHANGELOG.md b/CHANGELOG.md index 3759c59..73acb8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com ## [Unreleased] +- Support self-hosted runner that does not set `GITHUB_OUTPUT` environment variable. ([#17](https://github.com/taiki-e/create-gh-release-action/pull/17)) + ## [1.6.1] - 2022-10-14 - Fix invalid version format check introduced in 1.4.0. diff --git a/main.sh b/main.sh index 576e06b..c9c7b7c 100755 --- a/main.sh +++ b/main.sh @@ -113,7 +113,14 @@ fi # https://cli.github.com/manual/gh_release_create GITHUB_TOKEN="${token}" gh release create "${release_options[@]}" --title "${title}" --notes "${notes:-}" -# set (computed) prefix and version outputs for future step use +# Set (computed) prefix and version outputs for future step use. computed_prefix=${tag%"${version}"} -echo "computed-prefix=${computed_prefix}" >>"${GITHUB_OUTPUT}" -echo "version=${version}" >>"${GITHUB_OUTPUT}" +if [[ -n "${GITHUB_OUTPUT:-}" ]]; then + echo "computed-prefix=${computed_prefix}" >>"${GITHUB_OUTPUT}" + echo "version=${version}" >>"${GITHUB_OUTPUT}" +else + # Self-hosted runner may not set GITHUB_OUTPUT. + warn "GITHUB_OUTPUT is not set; skip setting 'computed-prefix' and 'version' outputs" + echo "computed-prefix: ${computed_prefix}" + echo "version: ${version}" +fi