Set PROTOC environment variable when installing protoc

This commit is contained in:
Taiki Endo
2022-08-01 17:40:32 +09:00
parent b1b32c59f1
commit 878e967972
2 changed files with 10 additions and 0 deletions

View File

@@ -10,6 +10,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com
## [Unreleased]
- Set the `PROTOC` environment variable when installing `protoc` if it has not already been set.
## [1.9.0] - 2022-08-01
- Support `protoc`.

View File

@@ -239,6 +239,14 @@ for tool in "${tools[@]}"; do
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
esac
download "${url}" /usr/local/bin "bin/protoc${exe}"
if [[ -z "${PROTOC:-}" ]]; then
info "setting PROTOC environment variable"
if [[ -d /usr/local/bin ]]; then
echo "PROTOC=/usr/local/bin/protoc${exe}" >>"${GITHUB_ENV}"
else
echo "PROTOC=${HOME}/.install-action/bin/protoc${exe}" >>"${GITHUB_ENV}"
fi
fi
;;
shellcheck)
# https://github.com/koalaman/shellcheck/releases