zigbee2mqtt: improve update script
This commit is contained in:
parent
e267ff0f39
commit
3507c87774
1 changed files with 17 additions and 16 deletions
|
@ -1,30 +1,31 @@
|
||||||
#!/usr/bin/env nix-shell
|
#!/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)')
|
set -euo pipefail
|
||||||
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
|
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
|
if [[ "$CURRENT_VERSION" == "$TARGET_VERSION" ]]; then
|
||||||
echo "zigbee2mqtt is up-to-date: ${CURRENT_VERSION}"
|
echo "zigbee2mqtt is up-to-date: ${CURRENT_VERSION}"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ZIGBEE2MQTT=https://github.com/Koenkk/zigbee2mqtt/raw/$TARGET_VERSION
|
||||||
curl -LO $ZIGBEE2MQTT/package.json
|
curl -LO $ZIGBEE2MQTT/package.json
|
||||||
curl -LO $ZIGBEE2MQTT/npm-shrinkwrap.json
|
curl -LO $ZIGBEE2MQTT/npm-shrinkwrap.json
|
||||||
|
|
||||||
node2nix --nodejs-12 \
|
node2nix \
|
||||||
-l npm-shrinkwrap.json \
|
--composition node.nix \
|
||||||
-c node.nix \
|
--lock npm-shrinkwrap.json \
|
||||||
--bypass-cache \
|
|
||||||
--no-copy-node-env \
|
--no-copy-node-env \
|
||||||
--node-env ../../development/node-packages/node-env.nix
|
--node-env ../../development/node-packages/node-env.nix \
|
||||||
|
--nodejs-14 \
|
||||||
|
--output node-packages.nix
|
||||||
|
|
||||||
rm package.json npm-shrinkwrap.json
|
rm package.json npm-shrinkwrap.json
|
||||||
|
|
||||||
{
|
(
|
||||||
cd ../../..
|
cd ../../../
|
||||||
nix-update --version "$TARGET_VERSION" --build zigbee2mqtt
|
update-source-version zigbee2mqtt "$TARGET_VERSION"
|
||||||
}
|
)
|
||||||
|
|
||||||
git add ./default.nix ./node-packages.nix ./node.nix
|
|
||||||
git commit -m "zigbee2mqtt: ${CURRENT_VERSION} -> ${TARGET_VERSION}"
|
|
||||||
|
|
Loading…
Reference in a new issue