summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/li/linear/update.sh
blob: 8a381a4bc56020672f7f85bd74eb15ecb25e2e6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p coreutils curl gnugrep jq common-updater-scripts
#shellcheck shell=bash

set -euo pipefail

releases_url="https://releases.linear.app"
version_pattern='filename="Linear-\K[0-9]+(\.[0-9]+)*(?=-universal\.dmg")'
version="$(curl -fsSLI "$releases_url/mac" | grep -ioP "$version_pattern")"

if [[ -z $version ]]; then
  echo "Could not find the latest Linear version in release headers" >&2
  exit 1
fi

hash="$(nix store prefetch-file --json "$releases_url/Linear-${version}-universal.dmg" | jq -r .hash)"

update-source-version linear "$version" "$hash" --ignore-same-version