Add GitHub Action for publishing the extension CLI (#9542)

This PR adds a GitHub Action for publishing the extension CLI.

When the `extension-cli` tag is pushed, this Action will run, build the
`zed-extension` binary, and upload it to DigitalOcean for consumption.

This will allow us to consume the pre-built binary in the CI for the
extensions repo.

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
This commit is contained in:
Marshall Bowers 2024-03-19 14:19:32 -04:00 committed by GitHub
parent 2ea333fff6
commit 905a24079a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 102 additions and 56 deletions

View file

@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -euxo pipefail
source script/lib/blob-store.sh
build_flag="--release"
target_dir="release"
@ -30,29 +31,6 @@ Options:
"
}
function uploadDsym
{
SPACE="zed-debug-symbols"
REGION="nyc3"
file_to_upload="$1"
file_name="$2"
date=$(date +"%a, %d %b %Y %T %z")
acl="x-amz-acl:public-read"
content_type="application/octet-stream"
storage_type="x-amz-storage-class:STANDARD"
string="PUT\n\n${content_type}\n${date}\n${acl}\n${storage_type}\n/${SPACE}/${file_name}"
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: ${SPACE}.${REGION}.digitaloceanspaces.com" \
-H "Date: $date" \
-H "Content-Type: $content_type" \
-H "$storage_type" \
-H "$acl" \
-H "Authorization: AWS ${DIGITALOCEAN_SPACES_ACCESS_KEY}:$signature" \
"https://${SPACE}.${REGION}.digitaloceanspaces.com/${file_name}"
}
while getopts 'dlfoh' flag
do
case "${flag}" in
@ -152,7 +130,10 @@ function prepare_binaries() {
gzip target/${architecture}/${target_dir}/Zed.dwarf
echo "Uploading dSYMs for $architecture"
uploadDsym target/${architecture}/${target_dir}/Zed.dwarf.gz "$channel/Zed-$version-${architecture}.dwarf.gz"
upload_to_blob_store_public \
"zed-debug-symbols" \
target/${architecture}/${target_dir}/Zed.dwarf.gz \
"$channel/Zed-$version-${architecture}.dwarf.gz"
cp target/${architecture}/${target_dir}/${binary_name} "${app_path}/Contents/MacOS/${zed_crate}"
cp target/${architecture}/${target_dir}/cli "${app_path}/Contents/MacOS/cli"