From c0d51ecf81ca7df1727c127c65ca9ddf2610cc7a Mon Sep 17 00:00:00 2001 From: Deepak Bomjan Date: Thu, 9 May 2024 11:41:01 +0545 Subject: [PATCH] ci: use script to download artifact --- .github/workflows/sui-move-build-test.yml | 9 +-------- scripts/install_sui.sh | 9 +++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 scripts/install_sui.sh diff --git a/.github/workflows/sui-move-build-test.yml b/.github/workflows/sui-move-build-test.yml index 6c19d801f..9fb9ae9f1 100644 --- a/.github/workflows/sui-move-build-test.yml +++ b/.github/workflows/sui-move-build-test.yml @@ -22,14 +22,7 @@ jobs: submodules: recursive - name: Install sui - run: | - echo "Testing" - latest_tag=$(curl -sSL https://api.github.com/repos/MystenLabs/sui/releases/latest | jq -r '.tag_name') - ubuntu_artifact="sui-mainnet-${latest_tag#mainnet-}-ubuntu-x86_64.tgz" - browser_download_url=$(curl -sSL https://api.github.com/repos/MystenLabs/sui/releases/latest | jq -r '.assets[] | select(.name == "${ubuntu_artifact}") | .browser_download_url') - echo $browser_download_url - curl -LO ${browser_download_url} - sudo tar -xzvf ${ubuntu_artifact} sui -C /usr/local/bin + run: bash -x ./scripts/install_sui.sh - name: build and test run: bash ./scripts/optimize-move.sh diff --git a/scripts/install_sui.sh b/scripts/install_sui.sh new file mode 100644 index 000000000..646585379 --- /dev/null +++ b/scripts/install_sui.sh @@ -0,0 +1,9 @@ +#!/bin/bash +## Install sui binary from latest mainnet release +repo_url="https://api.github.com/repos/MystenLabs/sui/releases/latest" +latest_tag=$(curl -sSL "$repo_url" | jq -r '.tag_name') +ubuntu_artifact="sui-mainnet-${latest_tag#mainnet-}-ubuntu-x86_64.tgz" +browser_download_url=$(curl -sSL "$repo_url" | jq -r --arg ua "$ubuntu_artifact" '.assets[] | select(.name == $ua) | .browser_download_url') +curl -sSL -o "$ubuntu_artifact" "$browser_download_url" +sudo tar -xzvf "$ubuntu_artifact" sui -C /usr/local/bin +rm "$ubuntu_artifact"