diff --git a/.github/workflows/debricked-cli.yml b/.github/workflows/debricked-cli.yml index c3365b2..545ba2d 100644 --- a/.github/workflows/debricked-cli.yml +++ b/.github/workflows/debricked-cli.yml @@ -14,61 +14,31 @@ jobs: with: ref: '6-integrate-debricked-cli-with-vs-code-extension-2' - - name: Get latest release info - cli_windows_x86_64 - id: cli_windows_x86_64 + - name: Get latest release info + id: get_latest_release run: | latest_release=$(curl -s https://api.github.com/repos/debricked/cli/releases/tags/v2.0.3) - download_url=$(echo "$latest_release" | jq -r '.assets[] | select(.name | endswith("cli_windows_x86_64.tar.gz")).browser_download_url') - echo "Download URL: $download_url" - echo "download_url=$download_url" >> $GITHUB_OUTPUT + echo "latest_release=$latest_release" >> $GITHUB_ENV - - name: Download latest release - cli_windows_x86_64 + - name: Download and extract CLI + id: download_and_extract run: | - mkdir -p resources/debricked-cli/cli_windows_x86_64 - echo "Download URL: ${{ steps.cli_windows_x86_64.outputs.download_url }}" - curl -L ${{ steps.cli_windows_x86_64.outputs.download_url }} -o resources/debricked-cli/cli_windows_x86_64/debricked-cli.tar.gz + assets=("cli_windows_x86_64.tar.gz" "cli_windows_i386.tar.gz","cli_windows_arm64.tar.gz") + for asset in "${assets[@]}"; do + download_url=$(echo "$latest_release" | jq -r ".assets[] | select(.name == \"$asset\").browser_download_url") + dir_name="${asset%.*.*}" # Remove ".tar.gz" from filename + mkdir -p "resources/debricked-cli/$dir_name" + curl -L "$download_url" -o "resources/debricked-cli/$dir_name/debricked-cli.tar.gz" + tar -xzf "resources/debricked-cli/$dir_name/debricked-cli.tar.gz" -C "resources/debricked-cli/$dir_name" + rm "resources/debricked-cli/$dir_name/debricked-cli.tar.gz" + done - - name: Extract Debricked CLI - cli_windows_x86_64 - run: | - tar -xzf resources/debricked-cli/cli_windows_x86_64/debricked-cli.tar.gz -C resources/debricked-cli/cli_windows_x86_64 - rm resources/debricked-cli/cli_windows_x86_64/debricked-cli.tar.gz - - - name: Commit changes - cli_windows_x86_64 - run: | - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - git add resources/debricked-cli/cli_windows_x86_64 - git commit -m "Update Debricked CLI to latest release" - git push - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Get latest release info - cli_windows_i386 - id: cli_windows_i386 - run: | - latest_release=$(curl -s https://api.github.com/repos/debricked/cli/releases/tags/v2.0.3) - download_url=$(echo "$latest_release" | jq -r '.assets[] | select(.name | endswith("cli_windows_i386.tar.gz")).browser_download_url') - echo "Download URL: $download_url" - echo "download_url=$download_url" >> $GITHUB_OUTPUT - - - name: Download latest release - cli_windows_i386 - run: | - mkdir -p resources/debricked-cli/cli_windows_i386 - echo "Download URL: ${{ steps.cli_windows_i386.outputs.download_url }}" - curl -L ${{ steps.cli_windows_i386.outputs.download_url }} -o resources/debricked-cli/cli_windows_i386/debricked-cli.tar.gz - - - name: Extract Debricked CLI - cli_windows_i386 - run: | - tar -xzf resources/debricked-cli/cli_windows_i386/debricked-cli.tar.gz -C resources/debricked-cli/cli_windows_i386 - rm resources/debricked-cli/cli_windows_i386/debricked-cli.tar.gz - - - name: Commit changes - cli_windows_i386 + - name: Commit changes run: | git config --global user.name 'github-actions[bot]' git config --global user.email 'github-actions[bot]@users.noreply.github.com' - git add resources/debricked-cli/cli_windows_i386 + git add resources/debricked-cli git commit -m "Update Debricked CLI to latest release" git push env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - \ No newline at end of file