6.NUR/ci/update-nur-search.sh
2025-02-13 14:59:44 -08:00

30 lines
721 B
Bash
Executable file

#!/usr/bin/env nix-shell
#!nix-shell -p git -p nix -p bash -i bash
set -eu -o pipefail # Exit with nonzero exit code if anything fails
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
source ${DIR}/lib/setup-git.sh
set -x
# build package.json for nur-search
# ---------------------------------
nix build "${DIR}#"
cd "${DIR}/.."
nix run "${DIR}#" -- index nur-combined > nur-search/data/packages.json
# rebuild and publish nur-search repository
# -----------------------------------------
cd nur-search
if [[ ! -z "$(git diff --exit-code)" ]]; then
git add ./data/packages.json
git commit -m "automatic update package.json"
else
echo "nothings changed will not commit anything"
fi