Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetch binary built for oldest macOS version #51

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 13 additions & 21 deletions scripts/fetch-envoy
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,19 @@ extract_envoy_from_homebrew() {
_version="${_envoy_tag:1}"
_tmp_dir="$(mktemp -d 2>/dev/null || mktemp -d -t 'tmp_dir')"

if [ "$_arch" == "arm64" ]; then
(
cd "$_tmp_dir"
oras pull "ghcr.io/homebrew/core/envoy:${_version}" --platform "darwin/arm64"
tar --extract \
--file envoy--*.bottle.tar.gz \
--directory . \
--strip-components=3 \
"envoy/${_version}/bin/envoy"
)
else
(
cd "$_tmp_dir"
oras pull ghcr.io/homebrew/core/envoy:"${_version}" --platform "darwin/amd64"
tar --extract \
--file envoy--*.bottle.tar.gz \
--directory . \
--strip-components=3 \
"envoy/${_version}/bin/envoy"
)
fi
(
cd "$_tmp_dir"
_digest=$(oras manifest fetch "ghcr.io/homebrew/core/envoy:${_version}" |
jq -r ".manifests |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is jq available in the default tools for action runner ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map(select(.platform | contains({os: \"$_os\", architecture: \"$_arch\"}))) |
min_by(.platform[\"os.version\"]) | .digest")
oras pull "ghcr.io/homebrew/core/envoy:${_version}@${_digest}"
tar --extract \
--file envoy--*.bottle.tar.gz \
--directory . \
--strip-components=3 \
"envoy/${_version}/bin/envoy"
)
mv -f "$_tmp_dir/envoy" "$_bin_dir/envoy-$_os-$_arch"
}

Expand Down