Skip to content

Commit af72bb2

Browse files
committed
standalone
1 parent 1cb20df commit af72bb2

File tree

1 file changed

+38
-16
lines changed

1 file changed

+38
-16
lines changed

.github/workflows/main_pubsite.yml

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,66 @@ name: Build & Deploy to Azure Web App (pubsite)
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [ main ]
66
workflow_dispatch:
77

88
permissions:
9-
contents: read
10-
id-token: write
9+
contents: read # for actions/checkout
10+
id-token: write # for OIDC login to Azure
1111

1212
jobs:
13-
build-and-deploy:
13+
build:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
# 1. Check out code
18-
- uses: actions/checkout@v4
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
1919

20-
# 2. Set up Node.js
21-
- uses: actions/setup-node@v3
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v3
2222
with:
2323
node-version: '20'
2424

25-
# 3. Install & build
26-
- run: npm ci
27-
- run: npm run build
25+
- name: Install dependencies
26+
run: npm ci
2827

29-
# 4. Zip up everything for App Service
30-
- run: zip -r pubsite.zip . -x ".git/**" "node_modules/**"
28+
- name: Build Next.js app
29+
run: npm run build
30+
31+
- name: Create deployment package
32+
run: |
33+
# include node_modules so `next start` is available
34+
zip -r pubsite.zip . -x ".git/*" ".github/*"
35+
36+
- name: Upload artifact
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: site-package
40+
path: pubsite.zip
41+
42+
deploy:
43+
runs-on: ubuntu-latest
44+
needs: build
45+
46+
steps:
47+
- name: Download artifact
48+
uses: actions/download-artifact@v4
49+
with:
50+
name: site-package
51+
path: .
52+
53+
- name: Unzip package
54+
run: unzip -o pubsite.zip
3155

32-
# 5. Login to Azure using OIDC
3356
- name: Azure Login
3457
uses: azure/login@v2
3558
with:
3659
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_E5978DC6004B4BB995ACD60ADAF513EF }}
3760
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_8824E98435E440FAA46E146AD7716A44 }}
3861
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_6A3ECC57385541ACB3AC40EA396FC5B5 }}
3962

40-
# 6. Deploy the zip to your Web App
4163
- name: Deploy to Azure Web App
4264
uses: azure/webapps-deploy@v3
4365
with:
4466
app-name: pubsite
45-
package: pubsite.zip
67+
package: .

0 commit comments

Comments
 (0)