scripts: minor improvements
This commit is contained in:
parent
aa8526cda0
commit
083eb16b39
|
@ -1,13 +1,18 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
scripts_dir="$(dirname $0)"
|
scripts_dir="$(dirname "$0")"
|
||||||
python_script="$scripts_dir/generate-dependency-queue.py"
|
python_script="$scripts_dir/generate-dependency-queue.py"
|
||||||
registry_url="https://git.distrust.co/api/packages/public/cargo"
|
registry_url="https://git.distrust.co/api/packages/public/cargo"
|
||||||
search_url="${registry_url}/api/v1/crates"
|
search_url="${registry_url}/api/v1/crates"
|
||||||
|
|
||||||
cargo metadata --format-version=1 | python3 "$python_script" | while read crate version; do
|
cargo metadata --format-version=1 | python3 "$python_script" | while read -r crate version; do
|
||||||
# Verify the package does not exist
|
# Verify the package does not exist
|
||||||
|
if test "${crate}" = "keyfork-tests"; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
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
|
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"
|
cargo publish --registry distrust -p "$crate"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
set -eu
|
set -eu
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
@ -8,8 +9,8 @@ temp_file="$(mktemp)"
|
||||||
|
|
||||||
cargo metadata --format-version=1 | jq -r '.packages[] | select(.source == null) | .name + " " + .manifest_path + " " + .version' > "$temp_file"
|
cargo metadata --format-version=1 | jq -r '.packages[] | select(.source == null) | .name + " " + .manifest_path + " " + .version' > "$temp_file"
|
||||||
|
|
||||||
while read crate manifest_path version <&3; do
|
while read -r crate manifest_path version <&3; do
|
||||||
crate_path="$(dirname $manifest_path)"
|
crate_path="$(dirname "$manifest_path")"
|
||||||
git_log="$(git log --format='%h %s' "$LAST_REF".."$CURRENT_REF" "$crate_path")"
|
git_log="$(git log --format='%h %s' "$LAST_REF".."$CURRENT_REF" "$crate_path")"
|
||||||
git_tag="$(git tag --list "$crate-v${version}")"
|
git_tag="$(git tag --list "$crate-v${version}")"
|
||||||
if test ! -z "$git_log" -a -z "$git_tag"; then
|
if test ! -z "$git_log" -a -z "$git_tag"; then
|
||||||
|
@ -22,6 +23,7 @@ while read crate manifest_path version <&3; do
|
||||||
echo ""
|
echo ""
|
||||||
echo "# Crate: ${crate} ${version}"
|
echo "# Crate: ${crate} ${version}"
|
||||||
} | git tag --sign "${crate}-v${version}" -F - -e
|
} | git tag --sign "${crate}-v${version}" -F - -e
|
||||||
|
reset
|
||||||
echo "Making new tag: ${crate}-v${version}"
|
echo "Making new tag: ${crate}-v${version}"
|
||||||
fi
|
fi
|
||||||
done 3<"$temp_file"
|
done 3<"$temp_file"
|
||||||
|
|
Loading…
Reference in New Issue