-
Notifications
You must be signed in to change notification settings - Fork 550
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26e847b
commit 197df8a
Showing
4 changed files
with
204 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
if [[ -z "$AZURE_STORAGE_CONNECTION_STRING" ]]; then | ||
echo "AZURE_STORAGE_CONNECTION_STRING is required" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "$CONTAINER_NAME" ]]; then | ||
echo "CONTAINER_NAME is required" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "$BLOB_NAME" ]]; then | ||
echo "BLOB_NAME is required" | ||
exit 1 | ||
fi | ||
|
||
CACHE_PATH=${CACHE_PATH:-$BLOB_NAME} | ||
|
||
|
||
echo "--> Checking whether blob exists" | ||
EXISTS=$( | ||
az storage blob exists \ | ||
--container-name "$CONTAINER_NAME" \ | ||
--name "$BLOB_NAME" \ | ||
--connection-string "$AZURE_STORAGE_CONNECTION_STRING" \ | ||
--output tsv | ||
) | ||
echo "$EXISTS" | ||
|
||
if [[ "$EXISTS" = True ]]; then | ||
echo "--> Downloading and extracting blob" | ||
mkdir -p "$CACHE_PATH" | ||
az storage blob download \ | ||
--container-name "$CONTAINER_NAME" \ | ||
--name "$BLOB_NAME" \ | ||
--no-progress \ | ||
| tar -C "$CACHE_PATH" -x --zstd -f - | ||
echo "Extracted" | ||
|
||
echo "cache-hit=true" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "cache-hit=false" >> "$GITHUB_OUTPUT" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
if [[ -z "$AZURE_STORAGE_CONNECTION_STRING" ]]; then | ||
echo "AZURE_STORAGE_CONNECTION_STRING is required" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "$CONTAINER_NAME" ]]; then | ||
echo "CONTAINER_NAME is required" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "$BLOB_NAME" ]]; then | ||
echo "BLOB_NAME is required" | ||
exit 1 | ||
fi | ||
|
||
CACHE_PATH=${CACHE_PATH:-$BLOB_NAME} | ||
|
||
|
||
echo "--> Packaging cache directory" | ||
tar -C "$CACHE_PATH" -c --zstd -f "$CACHE_PATH.tar.zstd" . | ||
|
||
echo "--> Uploading blob" | ||
az storage blob upload \ | ||
-c "$CONTAINER_NAME" \ | ||
-n "$BLOB_NAME" \ | ||
-f "$CACHE_PATH.tar.zstd" \ | ||
--overwrite \ | ||
--no-progress |
Submodule binaries
updated
28 files