nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 33 lines 1.3 kB view raw
1#!/usr/bin/env nix-shell 2#!nix-shell -i bash -p bash curl jq nix nix-prefetch common-updater-scripts 3 4set -euo pipefail 5 6latestVersion=$(curl --fail --silent https://api.github.com/repos/microsoft/pgsql-tools/releases/latest | jq --raw-output '.tag_name | ltrimstr("v")') 7currentVersion=$(nix eval --raw -f . pgsql-tools.version 2>/dev/null || echo "unknown") 8 9echo "latest version: $latestVersion" 10echo "current version: $currentVersion" 11 12if [[ "$latestVersion" == "$currentVersion" ]]; then 13 echo "package is up-to-date" 14 exit 0 15fi 16 17update-source-version pgsql-tools "$latestVersion" --file=pkgs/by-name/pg/pgsql-tools/package.nix 18 19declare -A platforms=( 20 ["x86_64-linux"]="pgsqltoolsservice-linux-x64.tar.gz" 21 ["aarch64-linux"]="pgsqltoolsservice-linux-arm64.tar.gz" 22 ["x86_64-darwin"]="pgsqltoolsservice-osx-x86.tar.gz" 23 ["aarch64-darwin"]="pgsqltoolsservice-osx-arm64.tar.gz" 24) 25 26for system in "${!platforms[@]}"; do 27 filename="${platforms[$system]}" 28 url="https://github.com/microsoft/pgsql-tools/releases/download/v${latestVersion}/${filename}" 29 30 echo "Updating hash for $system..." 31 hash=$(nix --extra-experimental-features nix-command hash convert --to sri --hash-algo sha256 $(nix-prefetch-url "$url")) 32 update-source-version pgsql-tools "$latestVersion" "$hash" --system="$system" --ignore-same-version --ignore-same-hash 33done