Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed May 13, 2024
1 parent c2927f0 commit bd5c18c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
branches:
- main
- dev
- dev2
schedule:
- cron: '0 0,3,6,9,12,15,18,21 * * *'
workflow_dispatch:
Expand Down
30 changes: 20 additions & 10 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ download_and_checksum() {
checksum=""
fi
info "downloading ${url}"
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 "${url}" -o tmp
if type -P curl &>/dev/null; then
retry curl --proto '=https' --tlsv1.2 -fsSL --retry 10 "${url}" -o tmp
elif type -P wget &>/dev/null; then
retry wget --https-only --secure-protocol=TLSv1_2 "${url}" -O tmp
else
bail 'install-action requires at least any of curl or wget'
fi
if [[ -n "${checksum}" ]]; then
info "verifying sha256 checksum for $(basename "${url}")"
if type -P sha256sum &>/dev/null; then
Expand Down Expand Up @@ -488,9 +494,9 @@ case "${host_os}" in
if ! type -P jq &>/dev/null || ! type -P curl &>/dev/null || ! type -P tar &>/dev/null; then
case "${base_distro}" in
debian | fedora | suse | arch | alpine)
echo "::group::Install packages required for installation (jq, curl, and/or tar)"
echo "::group::Install packages required for installation (jq, curl or wget, tar)"
sys_packages=()
if ! type -P curl &>/dev/null; then
if ! type -P curl &>/dev/null && ! type -P wget &>/dev/null; then
sys_packages+=(ca-certificates curl)
fi
if ! type -P tar &>/dev/null; then
Expand All @@ -513,18 +519,21 @@ case "${host_os}" in
fi
echo "::endgroup::"
;;
*) warn "install-action requires at least jq and curl on non-Debian/Fedora/SUSE/Arch/Alpine-based Linux" ;;
*) warn "install-action requires at least jq and any of curl or wget on non-Debian/Fedora/SUSE/Arch/Alpine-based Linux" ;;
esac
fi
;;
macos)
if ! type -P jq &>/dev/null || ! type -P curl &>/dev/null; then
warn "install-action requires at least jq and curl on macOS"
if ! type -P curl &>/dev/null && ! type -P wget &>/dev/null; then
brew install curl
fi
if ! type -P jq &>/dev/null; then
brew install jq
fi
;;
windows)
if ! type -P curl &>/dev/null; then
warn "install-action requires at least curl on Windows"
if ! type -P curl &>/dev/null && ! type -P wget &>/dev/null; then
warn "install-action requires at least any of curl or wget on Windows"
fi
# https://github.com/jqlang/jq/issues/1854
jq_use_b=1
Expand All @@ -539,9 +548,10 @@ case "${host_os}" in
jq=''
jq_use_b=''
else
info "old jq (${jq_version}) has bug on Windows; downloading jq 1.7 (will not be added to PATH)"
new_jq_version=1.7.1
info "pre-1.7 jq (${jq_version}) has bug on Windows; downloading jq ${new_jq_version} (will not be added to PATH)"
mkdir -p "${install_action_dir}/jq/bin"
url='https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-windows-amd64.exe'
url="https://github.com/jqlang/jq/releases/download/jq-${new_jq_version}/jq-windows-amd64.exe"
checksum='7451fbbf37feffb9bf262bd97c54f0da558c63f0748e64152dd87b0a07b6d6ab'
(
cd "${install_action_dir}/jq/bin"
Expand Down

0 comments on commit bd5c18c

Please sign in to comment.