Harden update and release tooling
ci / test (push) Has been cancelled
ci / fuzz-smoke (push) Has been cancelled
ci / windows-client (push) Has been cancelled
ci / package-release (linux-x86_64, ubuntu-latest) (push) Has been cancelled
ci / package-release (macos-aarch64, macos-14) (push) Has been cancelled
ci / package-release (macos-x86_64, macos-13) (push) Has been cancelled
ci / package-release (windows-x86_64, windows-latest) (push) Has been cancelled
ci / remote-bench (push) Has been cancelled
ci / test (push) Has been cancelled
ci / fuzz-smoke (push) Has been cancelled
ci / windows-client (push) Has been cancelled
ci / package-release (linux-x86_64, ubuntu-latest) (push) Has been cancelled
ci / package-release (macos-aarch64, macos-14) (push) Has been cancelled
ci / package-release (macos-x86_64, macos-13) (push) Has been cancelled
ci / package-release (windows-x86_64, windows-latest) (push) Has been cancelled
ci / remote-bench (push) Has been cancelled
This commit is contained in:
@@ -12,11 +12,7 @@ start_server=1
|
||||
force_config=0
|
||||
update_cache="${DOSH_UPDATE_CACHE:-$HOME/.cache/dosh/source}"
|
||||
quiet="${DOSH_UPDATE_QUIET:-0}"
|
||||
if [ "${DOSH_UPDATE_QUIET:-0}" = "1" ] && [ "${DOSH_BINARY_REQUIRED:-0}" != "1" ]; then
|
||||
use_prebuilt=0
|
||||
else
|
||||
use_prebuilt="${DOSH_USE_PREBUILT:-1}"
|
||||
fi
|
||||
binary_url="${DOSH_BINARY_URL:-}"
|
||||
binary_base="${DOSH_BINARY_BASE:-}"
|
||||
binary_name="${DOSH_BINARY_NAME:-}"
|
||||
|
||||
@@ -99,6 +99,21 @@ fi
|
||||
|
||||
web_repo="${base%/}/${repo}"
|
||||
failed=0
|
||||
artifact_version() {
|
||||
artifact="$1"
|
||||
case "$artifact" in
|
||||
*.tar.gz)
|
||||
tar -xOf "$artifact" dosh/VERSION 2>/dev/null | tr -d '\r\n'
|
||||
;;
|
||||
*.zip)
|
||||
unzip -p "$artifact" dosh/VERSION 2>/dev/null | tr -d '\r\n'
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
for artifact in target/dosh-release/dosh-linux-*.tar.gz target/dosh-release/dosh-macos-*.tar.gz target/dosh-release/dosh-windows-*.zip; do
|
||||
[ -f "$artifact" ] || continue
|
||||
name="$(basename "$artifact")"
|
||||
@@ -107,6 +122,11 @@ for artifact in target/dosh-release/dosh-linux-*.tar.gz target/dosh-release/dosh
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
actual="$(artifact_version "$artifact" || true)"
|
||||
if [ "$actual" != "$version" ]; then
|
||||
echo "skipping stale artifact $name: version ${actual:-unknown}, expected $version" >&2
|
||||
continue
|
||||
fi
|
||||
url="$web_repo/releases/download/$tag/$name"
|
||||
if curl -fsSI "$url" >/dev/null; then
|
||||
echo "verified $url"
|
||||
|
||||
@@ -32,6 +32,21 @@ token="${GITEA_TOKEN:-}"
|
||||
title="${GITEA_TITLE:-$tag}"
|
||||
expected_version="${tag#v}"
|
||||
|
||||
artifact_version() {
|
||||
artifact="$1"
|
||||
case "$artifact" in
|
||||
*.tar.gz)
|
||||
tar -xOf "$artifact" dosh/VERSION 2>/dev/null | tr -d '\r\n'
|
||||
;;
|
||||
*.zip)
|
||||
unzip -p "$artifact" dosh/VERSION 2>/dev/null | tr -d '\r\n'
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
if [ -z "$token" ] && [ -f "$HOME/.config/dosh/gitea-token" ]; then
|
||||
token="$(tr -d '\r\n' <"$HOME/.config/dosh/gitea-token")"
|
||||
fi
|
||||
@@ -52,6 +67,11 @@ if [ "$#" -eq 0 ]; then
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
actual="$(artifact_version "$artifact" || true)"
|
||||
if [ "$actual" != "$expected_version" ]; then
|
||||
echo "skipping $artifact: version ${actual:-unknown}, expected $expected_version" >&2
|
||||
continue
|
||||
fi
|
||||
if [ -f "$artifact.sha256" ]; then
|
||||
set -- "$@" "$artifact" "$artifact.sha256"
|
||||
else
|
||||
@@ -103,21 +123,6 @@ delete_existing_asset() {
|
||||
done
|
||||
}
|
||||
|
||||
artifact_version() {
|
||||
artifact="$1"
|
||||
case "$artifact" in
|
||||
*.tar.gz)
|
||||
tar -xOf "$artifact" dosh/VERSION 2>/dev/null | tr -d '\r\n'
|
||||
;;
|
||||
*.zip)
|
||||
unzip -p "$artifact" dosh/VERSION 2>/dev/null | tr -d '\r\n'
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
verify_release_artifact_version() {
|
||||
artifact="$1"
|
||||
name="$(basename "$artifact")"
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#[test]
|
||||
fn quiet_update_keeps_prebuilt_enabled_by_default() {
|
||||
let install = include_str!("../install.sh");
|
||||
assert!(install.contains("use_prebuilt=\"${DOSH_USE_PREBUILT:-1}\""));
|
||||
assert!(
|
||||
!install.contains("use_prebuilt=0"),
|
||||
"quiet updates must not force source builds"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn release_scripts_skip_stale_artifacts_when_auto_discovering() {
|
||||
let upload = include_str!("../scripts/upload-gitea-release.sh");
|
||||
assert!(upload.contains("skipping $artifact: version"));
|
||||
assert!(upload.contains("expected_version"));
|
||||
|
||||
let publish = include_str!("../scripts/publish-gitea-release.sh");
|
||||
assert!(publish.contains("skipping stale artifact"));
|
||||
assert!(publish.contains("actual=\"$(artifact_version \"$artifact\" || true)\""));
|
||||
}
|
||||
Reference in New Issue
Block a user