keyfork/scripts/publish.sh

21 lines
679 B
Bash
Raw Normal View History

2025-02-05 03:01:56 +00:00
#!/bin/bash
2024-05-16 06:01:10 +00:00
set -eu
set -o pipefail
2025-02-05 03:01:56 +00:00
scripts_dir="$(dirname "$0")"
2024-05-16 06:01:10 +00:00
python_script="$scripts_dir/generate-dependency-queue.py"
registry_url="https://git.distrust.co/api/packages/public/cargo"
search_url="${registry_url}/api/v1/crates"
2025-02-05 03:01:56 +00:00
cargo metadata --format-version=1 | python3 "$python_script" | while read -r crate version; do
2024-05-16 06:01:10 +00:00
# Verify the package does not exist
2025-02-05 03:01:56 +00:00
if test "${crate}" = "keyfork-tests"; then
continue
fi
2024-05-16 06:01:10 +00:00
if ! curl "${search_url}?q=${crate}" 2>/dev/null | jq -e "$(printf '.crates | .[] | select(.name == "%s" and .max_version == "%s")' "$crate" "$version")" >/dev/null; then
cargo publish --registry distrust -p "$crate"
fi
done