Compare commits

...

3 Commits

Author SHA1 Message Date
Conrad Irwin
26b1ac6e8a Try to fix signature
Co-Authored-By: Zed AI <ai@zed.dev>
2025-06-05 16:10:34 -06:00
Conrad Irwin
87dfdbc9cd Try a x-amz-meta instead 2025-06-04 18:58:09 -06:00
Conrad Irwin
65014612ba Try to store the real version in Digital ocean 2025-06-04 17:11:27 -06:00
2 changed files with 41 additions and 12 deletions

View File

@@ -203,17 +203,24 @@ function prepare_binaries() {
version="$version-$(git rev-parse --short HEAD)"
fi
# Create version tag based on channel
version_tag="v${version}"
if [ "$channel" == "preview" ]; then
version_tag="v${version}-pre"
fi
echo "Removing existing gzipped dSYMs for $architecture"
rm -f target/${architecture}/${target_dir}/Zed.dwarf.gz
echo "Gzipping dSYMs for $architecture"
gzip -f target/${architecture}/${target_dir}/Zed.dwarf
echo "Uploading dSYMs${architecture} for $architecture to by-uuid/${uuid}.dwarf.gz"
echo "Uploading dSYMs${architecture} for $architecture to by-uuid/${uuid}.dwarf.gz with version tag ${version_tag}"
upload_to_blob_store_public \
"zed-debug-symbols" \
target/${architecture}/${target_dir}/Zed.dwarf.gz \
"by-uuid/${uuid}.dwarf.gz"
"by-uuid/${uuid}.dwarf.gz" \
"x-amz-meta-zed-version: ${version_tag}"
cp target/${architecture}/${target_dir}/zed "${app_path}/Contents/MacOS/zed"
cp target/${architecture}/${target_dir}/cli "${app_path}/Contents/MacOS/cli"

View File

@@ -4,29 +4,51 @@ function upload_to_blob_store_with_acl
file_to_upload="$2"
blob_store_key="$3"
acl="$4"
custom_headers="${5:-}"
date=$(date +"%a, %d %b %Y %T %z")
content_type="application/octet-stream"
storage_type="x-amz-storage-class:STANDARD"
# Build the canonical amz headers string for signature calculation
amz_headers=""
if [ -n "$custom_headers" ]; then
# Extract x-amz-* headers and format them for signature
# Convert to lowercase and sort (required for AWS signature)
amz_header=$(echo "$custom_headers" | tr '[:upper:]' '[:lower:]' | sed 's/: */:/g')
if [[ "$amz_header" == x-amz-* ]]; then
amz_headers="${amz_header}\n"
fi
fi
string="PUT\n\n${content_type}\n${date}\n${amz_headers}${acl}\n${storage_type}\n/${bucket_name}/${blob_store_key}"
string="PUT\n\n${content_type}\n${date}\n${acl}\n${storage_type}\n/${bucket_name}/${blob_store_key}"
signature=$(echo -en "${string}" | openssl sha1 -hmac "${DIGITALOCEAN_SPACES_SECRET_KEY}" -binary | base64)
curl --fail -vv -s -X PUT -T "$file_to_upload" \
-H "Host: ${bucket_name}.nyc3.digitaloceanspaces.com" \
-H "Date: $date" \
-H "Content-Type: $content_type" \
-H "$storage_type" \
-H "$acl" \
-H "Authorization: AWS ${DIGITALOCEAN_SPACES_ACCESS_KEY}:$signature" \
"https://${bucket_name}.nyc3.digitaloceanspaces.com/${blob_store_key}"
curl_cmd="curl --fail -vv -s -X PUT -T \"$file_to_upload\" \
-H \"Host: ${bucket_name}.nyc3.digitaloceanspaces.com\" \
-H \"Date: $date\" \
-H \"Content-Type: $content_type\" \
-H \"$storage_type\" \
-H \"$acl\" \
-H \"Authorization: AWS ${DIGITALOCEAN_SPACES_ACCESS_KEY}:$signature\""
if [ -n "$custom_headers" ]; then
curl_cmd="$curl_cmd -H \"$custom_headers\""
fi
curl_cmd="$curl_cmd \"https://${bucket_name}.nyc3.digitaloceanspaces.com/${blob_store_key}\""
eval $curl_cmd
}
function upload_to_blob_store_public
{
upload_to_blob_store_with_acl "$1" "$2" "$3" "x-amz-acl:public-read"
upload_to_blob_store_with_acl "$1" "$2" "$3" "x-amz-acl:public-read" "${4:-}"
}
function upload_to_blob_store
{
upload_to_blob_store_with_acl "$1" "$2" "$3" "x-amz-acl:private"
upload_to_blob_store_with_acl "$1" "$2" "$3" "x-amz-acl:private" "${4:-}"
}