From 2f1ec685665f6948486a3ab6c29f9c819f7eca4e Mon Sep 17 00:00:00 2001 From: Christoph Deppisch Date: Wed, 16 Aug 2023 22:56:28 +0200 Subject: [PATCH] fix(#3): Fix action with Camel K 2.x Use os arch when resolving CLI artifact to download --- .github/workflows/test.yaml | 6 ++++-- install.sh | 28 +++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 67f781a..f7810ed 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,6 +1,7 @@ name: Test on: + workflow_dispatch: pull_request: push: branches: @@ -54,8 +55,9 @@ jobs: - macos-latest - windows-latest version: - - v1.5.0 - - v1.4.1 + - v1.10.4 + - v1.12.1 + - v2.0.0 runs-on: ${{ matrix.os }} steps: - name: Checkout diff --git a/install.sh b/install.sh index 84f8d68..b7b45bd 100755 --- a/install.sh +++ b/install.sh @@ -32,7 +32,7 @@ EOF main() { local version="$DEFAULT_VERSION" local github_token= - + parse_command_line "$@" install_camel_k @@ -93,7 +93,20 @@ install_camel_k() { echo "Installing Camel K CLI version $version$info on $os..." - curl -L --silent https://github.com/apache/camel-k/releases/download/$install_version/camel-k-client-$binary_version-$os-64bit.tar.gz -o kamel.tar.gz + arch=$(get_arch) + if [[ $binary_version == 1.* ]] + then + arch="64bit" + + if [[ "$os" = "darwin" ]] + then + os="mac" + fi + fi + + echo "Loading camel-k/releases/download/$install_version/camel-k-client-$binary_version-$os-$arch.tar.gz" + + curl -L --silent https://github.com/apache/camel-k/releases/download/$install_version/camel-k-client-$binary_version-$os-$arch.tar.gz -o kamel.tar.gz mkdir -p _kamel tar -zxf kamel.tar.gz --directory ./_kamel @@ -125,7 +138,7 @@ get_os() { osline="$(uname -s)" case "${osline}" in Linux*) os=linux;; - Darwin*) os=mac;; + Darwin*) os=darwin;; CYGWIN*) os=windows;; MINGW*) os=windows;; Windows*) os=windows;; @@ -134,4 +147,13 @@ get_os() { echo ${os} } +get_arch() { + archline="$(uname -m)" + case "${archline}" in + x86_64*) arch="amd64";; + *) arch="${archline}" + esac + echo ${arch} +} + main "$@"