diff --git a/CHANGELOG.md b/CHANGELOG.md index edbba2e9..965d1d0e 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 `protoc` on Windows. + ## [1.10.1] - 2022-08-01 - Fix missing include files when installing `protoc` on Linux and macOS. diff --git a/README.md b/README.md index a3d0bfc2..1110a931 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ https://spdx.org/licenses | [**mdbook-linkcheck**](https://github.com/Michael-F-Bryan/mdbook-linkcheck) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases) | Linux, macOS, Windows | [MIT](https://github.com/Michael-F-Bryan/mdbook-linkcheck/blob/HEAD/LICENSE) | | [**mdbook**](https://github.com/rust-lang/mdBook) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/rust-lang/mdBook/releases) | Linux, macOS, Windows | [MPL-2.0](https://github.com/rust-lang/mdBook/blob/HEAD/LICENSE) | | [**nextest**](https://github.com/nextest-rs/nextest) (alias: `cargo-nextest`) | `$CARGO_HOME/bin` | [GitHub Releases](https://github.com/nextest-rs/nextest/releases) | Linux, macOS, Windows | [Apache-2.0](https://github.com/nextest-rs/nextest/blob/HEAD/LICENSE-APACHE) OR [MIT](https://github.com/nextest-rs/nextest/blob/HEAD/LICENSE-MIT) | -| [**protoc**](https://github.com/protocolbuffers/protobuf) | `/usr/local/bin` | [GitHub Releases](https://github.com/protocolbuffers/protobuf/releases) | Linux, macOS | [BSD-3-Clause](https://github.com/protocolbuffers/protobuf/blob/HEAD/LICENSE) | +| [**protoc**](https://github.com/protocolbuffers/protobuf) | `/usr/local/bin` | [GitHub Releases](https://github.com/protocolbuffers/protobuf/releases) | Linux, macOS, Windows | [BSD-3-Clause](https://github.com/protocolbuffers/protobuf/blob/HEAD/LICENSE) | | [**shellcheck**](https://www.shellcheck.net) | `/usr/local/bin` | [GitHub Releases](https://github.com/koalaman/shellcheck/releases) | Linux, macOS, Windows | [GPL-3.0-or-later](https://github.com/koalaman/shellcheck/blob/HEAD/LICENSE) | | [**shfmt**](https://github.com/mvdan/sh) | `/usr/local/bin` | [GitHub Releases](https://github.com/mvdan/sh/releases) | Linux, macOS, Windows | [BSD-3-Clause](https://github.com/mvdan/sh/blob/HEAD/LICENSE) | | [**valgrind**](https://valgrind.org) | `/snap/bin` | [snap](https://snapcraft.io/install/valgrind/ubuntu) | Linux | [GPL-2.0-or-later](https://valgrind.org/docs/manual/license.gpl.html) | diff --git a/main.sh b/main.sh index 1dd17551..d4df1673 100755 --- a/main.sh +++ b/main.sh @@ -240,10 +240,10 @@ for tool in "${tools[@]}"; do cygwin* | msys*) url="${base_url}-win64.zip" bin_dir="${HOME}/.install-action/bin" - # TODO - include_dir="" + include_dir="${HOME}/.install-action/include" if [[ ! -d "${bin_dir}" ]]; then mkdir -p "${bin_dir}" + mkdir -p "${include_dir}" echo "${bin_dir}" >>"${GITHUB_PATH}" export PATH="${PATH}:${bin_dir}" fi @@ -257,17 +257,20 @@ for tool in "${tools[@]}"; do retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "${url}" -o tmp.zip unzip tmp.zip mv "bin/protoc${exe}" "${bin_dir}/" - if [[ -n "${include_dir}" ]]; then - mkdir -p "${include_dir}/" - sudo cp -r include/. "${include_dir}/" - ls "${include_dir}/" + mkdir -p "${include_dir}/" + case "${OSTYPE}" in + linux* | darwin*) sudo cp -r include/. "${include_dir}/" ;; + cygwin* | msys*) + cp -r include/. "${include_dir}/" + bin_dir=$(sed <<<"${bin_dir}" 's/^\/c\//C:\\/') + ;; + esac + if [[ -z "${PROTOC:-}" ]]; then + info "setting PROTOC environment variable" + echo "PROTOC=${bin_dir}/protoc${exe}" >>"${GITHUB_ENV}" fi ) rm -rf .install-action-tmp - if [[ -z "${PROTOC:-}" ]]; then - info "setting PROTOC environment variable" - echo "PROTOC=${bin_dir}/protoc${exe}" >>"${GITHUB_ENV}" - fi ;; shellcheck) # https://github.com/koalaman/shellcheck/releases