about summary refs log tree commit diff
path: root/pkgs/servers/http/pomerium/updater.sh
blob: 0df47268ca9657bd606340ab49151decbaaec4a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p gnugrep coreutils curl wget jq nix-update prefetch-yarn-deps

set -euo pipefail
pushd "$(dirname "${BASH_SOURCE[0]}")"

owner="pomerium"
repo="pomerium"
version=`curl -s "https://api.github.com/repos/$owner/$repo/tags" | jq -r .[0].name | grep -oP "^v\K.*"`
url="https://raw.githubusercontent.com/$owner/$repo/v$version/"

if [[ "$UPDATE_NIX_OLD_VERSION" == "$version" ]]; then
    echo "Already up to date!"
    exit 0
fi

rm -f package.json yarn.lock
wget "$url/ui/yarn.lock" "$url/ui/package.json"
echo $(prefetch-yarn-deps) > yarn-hash
rm -f yarn.lock

popd
nix-update pomerium --version $version