anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / tools / misc / sharedown / update.sh
blobd08a258a6a838313994483e3bbd197fcd4fc3dec
1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p common-updater-scripts curl jq yarn yarn2nix-moretea.yarn2nix
4 set -euo pipefail
6 owner=kylon
7 repo=Sharedown
8 latestVersion=$(curl "https://api.github.com/repos/$owner/$repo/releases/latest" | jq -r '.tag_name')
9 currentVersion=$(nix-instantiate --eval --expr 'with import ./. {}; sharedown.version' | tr -d '"')
11 if [[ "$currentVersion" == "$latestVersion" && "${BUMP_LOCK-}" != "1" ]]; then
12 # Skip update when already on the latest version.
13 exit 0
16 update-source-version sharedown "$latestVersion"
18 dirname="$(realpath "$(dirname "$0")")"
19 sourceDir="$(nix-build -A sharedown.src --no-out-link)"
20 tempDir="$(mktemp -d)"
22 cp -r "$sourceDir"/* "$tempDir"
23 cd "$tempDir"
24 PUPPETEER_SKIP_DOWNLOAD=1 yarn install
25 yarn2nix > "$dirname/yarndeps.nix"
26 cp -r yarn.lock "$dirname"