nixpkgs/pkgs/servers/polaris/update-web.sh
Peder Bergebakken Sundt 50ba995a1c polaris: init at 0.13.5
Polaris is a self-hosted music streaming server, with a
web and android frontend. The web frontend is included.
https://github.com/agersant/polaris

Polaris-web uses an odd versioning schema: 'build-X'. We reuse
the upstream tags. Polaris CI releases automatically bundle the
latest available version of polaris-web, however 'polaris' has seen
no release since april 2021, while polaris-web has had 5 version
bumps since. Currently we package the version of polaris-web
bundled with polaris on github. Once the newer versions are tested
we might upgrade.
2022-07-08 12:27:48 -04:00

32 lines
980 B
Bash
Executable File

#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts nodePackages.node2nix curl jq gnused nix coreutils
set -euo pipefail
pushd .
cd "$(dirname "${BASH_SOURCE[0]}")"/../../..
latestVersion="$(curl -s "https://api.github.com/repos/agersant/polaris-web/releases?per_page=1" | jq -r ".[0].tag_name")"
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; polaris-web.version or (lib.getVersion polaris-web)" | tr -d '"')
if [[ "$currentVersion" == "$latestVersion" ]]; then
echo "polaris-web is up-to-date: $currentVersion"
exit 0
fi
update-source-version polaris-web "$latestVersion"
store_src="$(nix-build . -A polaris-web.src --no-out-link)"
popd
cd "$(dirname "${BASH_SOURCE[0]}")"
node2nix \
--nodejs-12 \
--development \
--node-env ../../development/node-packages/node-env.nix \
--input "$store_src"/package.json \
--lock "$store_src"/package-lock.json \
--output ./node-packages.nix \
--composition ./node-composition.nix