diff options
author | Martin Weinelt <hexa@darmstadt.ccc.de> | 2021-11-29 02:11:27 +0100 |
---|---|---|
committer | Martin Weinelt <hexa@darmstadt.ccc.de> | 2021-11-29 02:19:08 +0100 |
commit | 3507c8777462d1d7656c8ebb69636b96136abab4 (patch) | |
tree | 57392303f17c859a43207da93033705be8390556 /pkgs/servers/zigbee2mqtt | |
parent | e267ff0f39dc7cb7c840316891e0f8a19526c504 (diff) |
zigbee2mqtt: improve update script
Diffstat (limited to 'pkgs/servers/zigbee2mqtt')
-rwxr-xr-x | pkgs/servers/zigbee2mqtt/update.sh | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/pkgs/servers/zigbee2mqtt/update.sh b/pkgs/servers/zigbee2mqtt/update.sh index 14c4d93261d13..f1caee633885a 100755 --- a/pkgs/servers/zigbee2mqtt/update.sh +++ b/pkgs/servers/zigbee2mqtt/update.sh @@ -1,30 +1,31 @@ #!/usr/bin/env nix-shell -#! nix-shell -i bash -p nodePackages.node2nix nodejs-12_x curl jq nix-update +#! nix-shell -I nixpkgs=../../.. -i bash -p nodePackages.node2nix curl jq nix-update common-updater-scripts -CURRENT_VERSION=$(nix eval --raw '(with import ../../.. {}; zigbee2mqtt.version)') -TARGET_VERSION=$(curl https://api.github.com/repos/Koenkk/zigbee2mqtt/releases/latest | jq -r ".tag_name") -ZIGBEE2MQTT=https://github.com/Koenkk/zigbee2mqtt/raw/$TARGET_VERSION +set -euo pipefail + +CURRENT_VERSION=$(nix eval -f ../../.. --raw zigbee2mqtt.version) +TARGET_VERSION="$(curl https://api.github.com/repos/Koenkk/zigbee2mqtt/releases/latest | jq -r ".tag_name")" if [[ "$CURRENT_VERSION" == "$TARGET_VERSION" ]]; then echo "zigbee2mqtt is up-to-date: ${CURRENT_VERSION}" exit 0 fi +ZIGBEE2MQTT=https://github.com/Koenkk/zigbee2mqtt/raw/$TARGET_VERSION curl -LO $ZIGBEE2MQTT/package.json curl -LO $ZIGBEE2MQTT/npm-shrinkwrap.json -node2nix --nodejs-12 \ - -l npm-shrinkwrap.json \ - -c node.nix \ - --bypass-cache \ +node2nix \ + --composition node.nix \ + --lock npm-shrinkwrap.json \ --no-copy-node-env \ - --node-env ../../development/node-packages/node-env.nix -rm package.json npm-shrinkwrap.json + --node-env ../../development/node-packages/node-env.nix \ + --nodejs-14 \ + --output node-packages.nix -{ - cd ../../.. - nix-update --version "$TARGET_VERSION" --build zigbee2mqtt -} +rm package.json npm-shrinkwrap.json -git add ./default.nix ./node-packages.nix ./node.nix -git commit -m "zigbee2mqtt: ${CURRENT_VERSION} -> ${TARGET_VERSION}" +( + cd ../../../ + update-source-version zigbee2mqtt "$TARGET_VERSION" +) |