5757 restore-keys : |
5858 ${{ runner.os }}-node-
5959
60+ - name : Cache Docusaurus build
61+ uses : actions/cache@v3
62+ id : cache-build
63+ with :
64+ path : |
65+ .docusaurus
66+ build
67+ key : ${{ runner.os }}-docusaurus-build-${{ hashFiles('src/**', 'docs/**', 'blog/**', 'docusaurus.config.js', 'sidebars.js', 'package-lock.json') }}
68+ restore-keys : |
69+ ${{ runner.os }}-docusaurus-build-
70+
71+ - name : Cache webpack
72+ uses : actions/cache@v3
73+ with :
74+ path : node_modules/.cache
75+ key : ${{ runner.os }}-webpack-${{ hashFiles('**/package-lock.json') }}
76+ restore-keys : |
77+ ${{ runner.os }}-webpack-
78+
6079 - name : Install dependencies and build site
6180 run : |
6281 npm ci
82+
83+ # Check if we have a valid cached build
84+ if [[ "${{ steps.cache-build.outputs.cache-hit }}" == "true" ]]; then
85+ echo "Build cache found, checking if rebuild needed..."
86+ # Docusaurus will intelligently rebuild only what's changed
87+ else
88+ echo "No build cache found, performing full build..."
89+ fi
90+
91+ # Run build - Docusaurus will use its internal caching
6392 npm run build
6493 env :
6594 NODE_OPTIONS : " --max-old-space-size=16384"
98127 - name : Upload to Azure Blob Storage with AzCopy
99128 run : |
100129 echo "Deploying to ${{ needs.determine-environment.outputs.environment }} environment"
101- echo "Starting high-performance upload of ~60,000 files..."
130+ echo "Starting high-performance sync of changed files..."
102131
103132 # Create SAS token for azcopy (more secure than using key directly)
104133 end_date=$(date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ')
@@ -110,17 +139,17 @@ jobs:
110139 --expiry $end_date \
111140 --output tsv)
112141
113- # Use azcopy for parallel uploads (much faster for many files)
114- azcopy copy "./build/*" \
142+ # Use azcopy sync for incremental updates (only uploads changed files)
143+ # This is MUCH faster for subsequent deployments
144+ azcopy sync "./build/" \
115145 "https://${{ secrets.STORAGE_ACCOUNT_NAME }}.blob.core.windows.net/\$web?$sas_token" \
116- --recursive \
117- --overwrite=true \
118- --log-level=WARNING \
146+ --delete-destination=true \
147+ --compare-hash=MD5 \
148+ --log-level=INFO \
119149 --cap-mbps=0 \
120- --block-size-mb=4 \
121- --include-pattern="*"
150+ --block-size-mb=4
122151
123- echo "Upload completed!"
152+ echo "Sync completed! Only changed files were uploaded. "
124153
125154 - name : Set blob content types efficiently
126155 run : |
0 commit comments