python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / tools / virtualization / linode-cli / update.sh
blobdd37e41c53738d3c40f444c4e70515cdbf0ffb39
1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p curl gnugrep gnused jq yq-go
4 set -x -eu -o pipefail
6 cd $(dirname "${BASH_SOURCE[0]}")
8 SPEC_VERSION=$(curl -s https://www.linode.com/docs/api/openapi.yaml | yq eval '.info.version' -)
10 SPEC_SHA256=$(nix-prefetch-url --quiet https://raw.githubusercontent.com/linode/linode-api-docs/v${SPEC_VERSION}/openapi.yaml)
12 VERSION=$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \
13 -H "Accept: application/vnd.github.v3+json" \
14 "https://api.github.com/repos/linode/linode-cli/tags" \
15 | jq 'map(.name)' \
16 | grep '"' \
17 | sed 's/[ ",(^v)]//g' \
18 | grep -v -e rc -e list \
19 | cut -d '"' -f4 | sort -rV | head -n 1)
21 SHA256=$(nix-prefetch-url --quiet --unpack https://github.com/linode/linode-cli/archive/refs/tags/${VERSION}.tar.gz)
23 setKV () {
24 sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" ./default.nix
27 setKV specVersion ${SPEC_VERSION}
28 setKV specSha256 ${SPEC_SHA256}
29 setKV version ${VERSION}
30 setKV sha256 ${SHA256}