Add script to create and upload casks to S3
This commit is contained in:
parent
a076920855
commit
67855652de
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
**/.DS_Store
|
28
script/app-to-cask.sh
Executable file
28
script/app-to-cask.sh
Executable 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
|
Loading…
x
Reference in New Issue
Block a user