Skip to content

Commit bd42e59

Browse files
committed
chore: update Azure storage blob properties for GZIP files to process in parallel
1 parent ae580c6 commit bd42e59

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

.github/workflows/deployAzureStorage.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,32 @@ jobs:
3838
uses: azure/CLI@v1
3939
with:
4040
inlineScript: |
41-
# List all .gz files and update their properties one by one
42-
for file in $(find ./publish/wwwroot -name "*.gz"); do
41+
# Find all .gz files
42+
gz_files=$(find ./publish/wwwroot -name "*.gz")
43+
44+
# Set maximum number of parallel processes
45+
max_processes=10
46+
count=0
47+
48+
# Update properties in parallel
49+
for file in $gz_files; do
4350
relative_path=${file#./publish/wwwroot/}
4451
az storage blob update \
4552
--connection-string "${{ secrets.AZURE_STORAGE_ACCOUNT_CONNECTION_STRING }}" \
4653
--container-name '$web' \
4754
--name "$relative_path" \
4855
--content-encoding "gzip" \
49-
--content-type "application/octet-stream"
50-
done
56+
--content-type "application/octet-stream" &
57+
58+
# Increment process counter
59+
((count++))
60+
61+
# If we've reached max_processes, wait for them to complete
62+
if [ $count -eq $max_processes ]; then
63+
wait
64+
count=0
65+
fi
66+
done
67+
68+
# Wait for any remaining processes
69+
wait

0 commit comments

Comments
 (0)