From 878e967972bafc13f236ed7e474944f3428cb806 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Mon, 1 Aug 2022 17:40:32 +0900 Subject: [PATCH] Set PROTOC environment variable when installing protoc --- CHANGELOG.md | 2 ++ main.sh | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index febeb8d2..2dd7289f 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] +- Set the `PROTOC` environment variable when installing `protoc` if it has not already been set. + ## [1.9.0] - 2022-08-01 - Support `protoc`. diff --git a/main.sh b/main.sh index 918f0789..06c427b1 100755 --- a/main.sh +++ b/main.sh @@ -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