Skip to content

Commit 524e15b

Browse files
committed
Better version checking on our deploy script.
1 parent 8fd9ffb commit 524e15b

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

scripts/sign-and-deploy.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,23 @@ all_artifacts_downloaded() {
114114
return 0
115115
}
116116

117+
ensure_version() {
118+
local version="$1"
119+
local version_file="$WORK_DIR/.version"
120+
121+
if [[ -f "$version_file" ]]; then
122+
local existing
123+
existing=$(cat "$version_file")
124+
if [[ "$existing" != "$version" ]]; then
125+
log "Version mismatch: found $existing, expected $version. Clearing release-signed/..."
126+
rm -rf "$WORK_DIR"
127+
fi
128+
fi
129+
130+
mkdir -p "$WORK_DIR"
131+
echo "$version" > "$version_file"
132+
}
133+
117134
check_git_clean() {
118135
log "Checking git status..."
119136

@@ -699,6 +716,7 @@ main() {
699716
local version="${2:-}"
700717
[[ -z "$version" ]] && error "Usage: $(basename "$0") all <version>"
701718

719+
ensure_version "$version"
702720
check_git_clean
703721
download_artifacts "$version"
704722
prepare_sign_dir
@@ -712,6 +730,7 @@ main() {
712730
local version="${2:-}"
713731
[[ -z "$version" ]] && error "Usage: $(basename "$0") resume <version>"
714732

733+
ensure_version "$version"
715734
resume_download "$version"
716735
prepare_sign_dir
717736
sign_macos
@@ -735,12 +754,14 @@ main() {
735754
sign-updates)
736755
local version="${2:-}"
737756
[[ -z "$version" ]] && error "Usage: $(basename "$0") sign-updates <version>"
757+
ensure_version "$version"
738758
[[ -d "$SIGN_DIR" ]] || error "Signed work directory not found at $SIGN_DIR. Run all/resume first."
739759
sign_updates "$version"
740760
;;
741761
release)
742762
local version="${2:-}"
743763
[[ -z "$version" ]] && error "Usage: $(basename "$0") release <version>"
764+
ensure_version "$version"
744765
create_release "$version"
745766
;;
746767
*)

0 commit comments

Comments
 (0)