at master 1.1 kB view raw
1#!/usr/bin/env nix-shell 2#!nix-shell -i bash -p bash nix-update common-updater-scripts nix jq 3 4set -euo pipefail 5 6currentVersion=$(nix-instantiate --eval -E "with import ./. {}; ibmcloud-cli.version or (lib.getVersion ibmcloud-cli)" | tr -d '"') 7latestVersion=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} -sL https://api.github.com/repos/IBM-Cloud/ibm-cloud-cli-release/releases/latest | jq --raw-output .tag_name | sed 's/^v//') 8 9if [[ "$currentVersion" == "$latestVersion" ]]; then 10 echo "package is up-to-date: $currentVersion" 11 exit 0 12fi 13 14update-source-version ibmcloud-cli $latestVersion || true 15 16for system in \ 17 x86_64-linux \ 18 aarch64-linux \ 19 i686-linux \ 20 powerpc64le-linux \ 21 s390x-linux \ 22 x86_64-darwin \ 23 aarch64-darwin; do 24 tmp=$(mktemp -d) 25 curl -fsSL -o $tmp/ibmcloud-cli $(nix-instantiate --eval -E "with import ./. {}; ibmcloud-cli.src.url" --system "$system" | tr -d '"') 26 hash=$(nix --extra-experimental-features nix-command hash file $tmp/ibmcloud-cli) 27 update-source-version ibmcloud-cli $latestVersion $hash --system=$system --ignore-same-version 28 rm -rf $tmp 29done