meta: Add script to create and upload casks to S3

This commit is contained in:
june 2025-03-17 18:47:30 +13:00
parent a076920855
commit fa68f7d88a
Signed by untrusted user who does not match committer: breadone
GPG Key ID: FDC19FE143200483
2 changed files with 29 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
**/.DS_Store

28
script/app-to-cask.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
# Assign arguments to variables
APP_FILE=$1
ZIP_PATH=$(basename $APP_FILE)
# S3_BUCKET="https://dl.breadone.xyz/cask"
S3_BUCKET="https://dl.breadone.xyz/homebrew/casks"
echo "compressing $APP_FILE to $ZIP_PATH.zip"
# Compress the file
ditto -c -k --sequesterRsrc --keepParent $APP_FILE $ZIP_PATH.zip
# Get hash of file
hash=$(sha256 $ZIP_PATH.zip | awk '{ print $4 }')
echo "SHA256: $hash"
# get reported version of app
version=$(mdls -name kMDItemVersion $APP_FILE | awk '{ print $3 }')
echo "Version: $version"
# Upload the .app file to the specified S3 bucket
curl -X PUT "$S3_BUCKET/$ZIP_PATH.zip" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$ZIP_PATH.zip"
echo "Deleting $ZIP_PATH.zip..."
rm $ZIP_PATH.zip