# SPDX-FileCopyrightText: 2025 Tom Hubrecht # # SPDX-License-Identifier: EUPL-1.2 set -o errexit set -o nounset set -o pipefail shopt -s lastpipe out="$OUT_DIRECTORY" # Fetch the latest release tag version=$(curl -L \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/docusealco/docuseal/releases/latest | jq -r .tag_name) if [ "$version" == "$(jq -r .version <"$out/deps.json")" ]; then echo "No updates found" exit 0 fi # Switch to a clean workspace tmp=$(mktemp -d) cd "$tmp" # Clone the repository at the required release git clone --depth 1 "https://github.com/docusealco/docuseal" --branch "$version" . # Update the ruby files for platform in aarch64-linux aarch64-linux-musl arm64-darwin x86_64-linux x86_64-linux-musl; do bundle lock --remove-platform "$platform" done bundix -l >/dev/null # Compute the new hashes yarn_hash=$(nix-hash --to-sri --type sha256 "$(prefetch-yarn-deps yarn.lock | grep -v "Warning")") src_hash=$(nurl --hash "https://github.com/docusealco/docuseal" "$version") # Format gemset.nix nixfmt gemset.nix # Remove required ruby version sed -i "/ruby '.*'/d" Gemfile # Output the results cp yarn.lock "$out" cp gemset.nix Gemfile Gemfile.lock "$out/rubyEnv" cat <"$out/deps.json" { "yarn": { "hash": "$yarn_hash" }, "version": "$version", "hash": "$src_hash" } EOF