diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..79b5594 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**/.DS_Store diff --git a/script/app-to-cask.sh b/script/app-to-cask.sh new file mode 100755 index 0000000..b298468 --- /dev/null +++ b/script/app-to-cask.sh @@ -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