Skip to content

Commit

Permalink
Only upload if the key doesn't already exist locally.
Browse files Browse the repository at this point in the history
  • Loading branch information
angerman authored May 9, 2024
1 parent f923c9d commit 4918dbc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cabalHooks/postBuildHook.s3
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

CACHE_KEY="$1.tar.gz"

echo "S3 upload $1"
tar -czf "$CACHE_KEY" --exclude="$3/setup-config" "$3"
aws s3 cp "$CACHE_KEY" s3://"$CACHE_BUCKET"/devx-shell/"$CACHE_KEY" --endpoint-url "$AWS_ENDPOINT"
rm "$CACHE_KEY" # Optional: Cleanup local file
if ! test -f "$CACHE_KEY" ; then
echo "S3 upload $1"
tar -czf "$CACHE_KEY" --exclude="$3/setup-config" "$3"
aws s3 cp "$CACHE_KEY" s3://"$CACHE_BUCKET"/devx-shell/"$CACHE_KEY" --endpoint-url "$AWS_ENDPOINT"
rm "$CACHE_KEY" # Optional: Cleanup local file
fi

0 comments on commit 4918dbc

Please sign in to comment.