Skip to content

Commit f0a7432

Browse files
authored
Update build-and-deploy.yml
1 parent 14e9246 commit f0a7432

File tree

1 file changed

+81
-75
lines changed

1 file changed

+81
-75
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 81 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -34,74 +34,80 @@ jobs:
3434
fi
3535
3636
build:
37-
runs-on: ubuntu-latest
38-
needs: determine-environment
39-
environment: ${{ needs.determine-environment.outputs.environment }}
40-
permissions:
41-
contents: read
42-
env:
43-
APP_EXTERNAL_URL: ${{ secrets.APP_EXTERNAL_URL || vars.APP_EXTERNAL_URL }}
44-
steps:
45-
- name: Check out source code
46-
uses: actions/checkout@v4
47-
48-
- name: Set up Node.js
49-
uses: actions/setup-node@v3
50-
with:
51-
node-version: '22.x'
52-
53-
- name: Cache Node.js dependencies
54-
uses: actions/cache@v3
55-
with:
56-
path: ~/.npm
57-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
58-
restore-keys: |
59-
${{ runner.os }}-node-
60-
61-
- name: Cache Docusaurus build
62-
uses: actions/cache@v3
63-
id: cache-build
64-
with:
65-
path: |
66-
.docusaurus
67-
key: ${{ runner.os }}-docusaurus-${{ hashFiles('src/**', 'docs/**', 'blog/**', 'docusaurus.config.js', 'sidebars.js') }}
68-
restore-keys: |
69-
${{ runner.os }}-docusaurus-
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-
79-
- name: Install dependencies and build site
80-
run: |
81-
npm ci
82-
83-
if [[ "${{ steps.cache-build.outputs.cache-hit }}" == "true" ]]; then
84-
echo "Build cache found, checking if rebuild needed..."
85-
else
86-
echo "No build cache found, performing full build..."
87-
fi
88-
89-
npm run build
90-
env:
91-
NODE_OPTIONS: "--max-old-space-size=8192"
92-
NODE_ENV: ${{ needs.determine-environment.outputs.environment }}
93-
94-
- name: Upload artifact for deployment
95-
uses: actions/upload-artifact@v4
96-
with:
97-
name: build-output
98-
path: build/
99-
37+
runs-on: ubuntu-latest
38+
needs: determine-environment
39+
environment: ${{ needs.determine-environment.outputs.environment }}
40+
permissions:
41+
contents: read
42+
env:
43+
APP_EXTERNAL_URL: ${{ secrets.APP_EXTERNAL_URL || vars.APP_EXTERNAL_URL }}
44+
steps:
45+
- name: Check out source code
46+
uses: actions/checkout@v4
47+
48+
- name: Set up Node.js
49+
uses: actions/setup-node@v3
50+
with:
51+
node-version: '22.x'
52+
53+
- name: Get npm cache directory
54+
id: npm-cache-dir
55+
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
56+
57+
- name: Cache Node.js dependencies
58+
uses: actions/cache@v3
59+
with:
60+
path: ${{ steps.npm-cache-dir.outputs.dir }}
61+
# ✅ KEY UPDATED
62+
key: v2-${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
63+
restore-keys: |
64+
v2-${{ runner.os }}-node-
65+
66+
- name: Cache Docusaurus build
67+
uses: actions/cache@v3
68+
id: cache-build
69+
with:
70+
path: |
71+
.docusaurus
72+
# ✅ KEY UPDATED
73+
key: v2-${{ runner.os }}-docusaurus-${{ hashFiles('src/**', 'docs/**', 'blog/**', 'docusaurus.config.js', 'sidebars.js') }}
74+
restore-keys: |
75+
v2-${{ runner.os }}-docusaurus-
76+
77+
- name: Cache webpack
78+
uses: actions/cache@v3
79+
with:
80+
path: node_modules/.cache
81+
# ✅ KEY UPDATED
82+
key: v2-${{ runner.os }}-webpack-${{ hashFiles('**/package-lock.json') }}
83+
restore-keys: |
84+
v2-${{ runner.os }}-webpack-
85+
86+
- name: Install dependencies and build site
87+
run: |
88+
npm ci
89+
90+
if [[ "${{ steps.cache-build.outputs.cache-hit }}" == "true" ]]; then
91+
echo "Build cache found, checking if rebuild needed..."
92+
else
93+
echo "No build cache found, performing full build..."
94+
fi
95+
96+
npm run build
97+
env:
98+
NODE_OPTIONS: "--max-old-space-size=8192"
99+
NODE_ENV: ${{ needs.determine-environment.outputs.environment }}
100+
101+
- name: Upload artifact for deployment
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: build-output
105+
path: build/
106+
100107
deploy:
101108
runs-on: ubuntu-latest
102109
needs: [build, determine-environment]
103110
environment: ${{ needs.determine-environment.outputs.environment }}
104-
105111
steps:
106112
- name: Download build artifact
107113
uses: actions/download-artifact@v4
@@ -154,20 +160,20 @@ jobs:
154160
155161
# Web files
156162
echo "Setting MIME types for web files..."
157-
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.css" --content-type "text/css" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
158-
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.js" --content-type "application/javascript" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
159-
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.mjs" --content-type "application/javascript" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
160-
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.json" --content-type "application/json" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
161-
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.html" --content-type "text/html" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
162-
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.htm" --content-type "text/html" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
163-
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.xml" --content-type "application/xml" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
164-
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.txt" --content-type "text/plain" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
163+
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.css" --content-type "text/css" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
164+
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.js" --content-type "application/javascript" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
165+
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.mjs" --content-type "application/javascript" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
166+
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.json" --content-type "application/json" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
167+
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.html" --content-type "text/html" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
168+
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.htm" --content-type "text/html" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
169+
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.xml" --content-type "application/xml" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
170+
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.txt" --content-type "text/plain" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
165171
166172
# Images
167173
echo "Setting MIME types for images..."
168-
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.png" --content-type "image/png" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
169-
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.jpg" --content-type "image/jpeg" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
170-
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.jpeg" --content-type "image/jpeg" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
174+
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.png" --content-type "image/png" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
175+
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.jpg" --content-type "image/jpeg" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
176+
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.jpeg" --content-type "image/jpeg" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
171177
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.gif" --content-type "image/gif" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
172178
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.webp" --content-type "image/webp" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true
173179
az storage blob update-batch --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} --source '$web' --pattern "*.svg" --content-type "image/svg+xml" --if-unmodified-since "1970-01-01T00:00:00Z" --no-progress || true

0 commit comments

Comments
 (0)