nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 40 lines 1.6 kB view raw
1#!/usr/bin/env nix-shell 2#!nix-shell -i bash -p curl jq bundix ruby_3_4 prefetch-yarn-deps nix-update nixfmt 3 4set -eu -o pipefail 5set -x 6dir="$(dirname "$(readlink -f "$0")")" 7 8current=$(nix --extra-experimental-features nix-command eval --raw -f . docuseal.src.tag) 9latest=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/docusealco/docuseal/tags?per_page=1" | jq -r '.[0].name') 10 11if [[ "$current" == "$latest" ]]; then 12 echo "'docuseal' is up-to-date ($current == $latest)" 13 exit 0 14fi 15 16echo "Updating docuseal to $latest" 17 18repo=$(mktemp -d /tmp/docuseal-update.XXX) 19 20rm -f "$dir/gemset.nix" "$dir/Gemfile" "$dir/Gemfile.lock" "$dir/yarn.lock" 21 22docuseal_storepath=$(nix --extra-experimental-features "nix-command flakes" flake prefetch github:docusealco/docuseal/"$latest" --json | jq -r '.storePath') 23 24cp -r --no-preserve=mode,ownership $docuseal_storepath/* $repo/ 25 26# patch ruby version 27sed -i "/^ruby '[0-9]\+\.[0-9]\+\.[0-9]\+'$/d" "$repo/Gemfile" 28 29# fix: https://github.com/nix-community/bundix/issues/88 30BUNDLE_GEMFILE="$repo/Gemfile" bundler lock --remove-platform x86_64-linux --lockfile="$repo/Gemfile.lock" 31BUNDLE_GEMFILE="$repo/Gemfile" bundler lock --remove-platform aarch64-linux --lockfile="$repo/Gemfile.lock" 32# generate gemset.nix 33bundix --lock --lockfile="$repo/Gemfile.lock" --gemfile="$repo/Gemfile" --gemset="$dir/gemset.nix" 34 35# update 36cp "$repo/Gemfile" "$repo/Gemfile.lock" "$dir/" 37nix-update docuseal --version "$latest" 38nix-update docuseal --subpackage "docusealWeb" 39 40nixfmt "$dir/gemset.nix"