Skip to content

Commit b8f0045

Browse files
committed
yml... again
1 parent 456eb81 commit b8f0045

File tree

1 file changed

+33
-29
lines changed

1 file changed

+33
-29
lines changed

.github/workflows/azure-deploy.yml

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,51 @@
1-
name: Build & One-Deploy to Azure
1+
name: Build & Deploy to Azure Web App (pubsite)
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
27

38
permissions:
49
contents: read
510
id-token: write
611

7-
on:
8-
push:
9-
branches: [ main ]
12+
env:
13+
NODE_VERSION: '20'
1014

1115
jobs:
1216
build-and-deploy:
1317
runs-on: ubuntu-latest
14-
1518
steps:
16-
# 1️⃣ Check out your code
17-
- uses: actions/checkout@v3
19+
- name: ⬇️ Checkout
20+
uses: actions/checkout@v4
1821

19-
# 2️⃣ Authenticate to Azure
20-
- name: Azure Login
21-
uses: azure/login@v1
22+
- name: ⎔ Use Node ${{ env.NODE_VERSION }}
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: ${{ env.NODE_VERSION }}
26+
27+
- name: 📦 Install dependencies
28+
run: npm ci
29+
30+
- name: 🛠 Build Next.js app
31+
run: npm run build
32+
33+
- name: 🔐 Azure login (OIDC)
34+
uses: azure/login@v2
2235
with:
2336
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_E5978DC6004B4BB995ACD60ADAF513EF }}
2437
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_8824E98435E440FAA46E146AD7716A44 }}
2538
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_6A3ECC57385541ACB3AC40EA396FC5B5 }}
2639

27-
# 3️⃣ Use Node 20 and build
28-
- name: Setup Node.js
29-
uses: actions/setup-node@v3
30-
with:
31-
node-version: "20"
32-
- name: Install dependencies
33-
run: npm ci
34-
- name: Build
35-
run: npm run build
40+
- name: ⚙️ Ensure build-on-deploy
41+
run: |
42+
az webapp config appsettings set \
43+
--resource-group pubsite_group \
44+
--name pubsite \
45+
--settings SCM_DO_BUILD_DURING_DEPLOYMENT=true
3646
37-
# 4️⃣ Deploy with Azure CLI’s ZIP-push (OneDeploy under the hood)
38-
- name: Deploy via Azure CLI
39-
uses: azure/cli@v2
47+
- name: 🚀 Deploy to Azure Web App
48+
uses: azure/webapps-deploy@v3
4049
with:
41-
azcliversion: latest
42-
inlineScript: |
43-
az webapp deploy \
44-
--resource-group myPortfolioRG \
45-
--name pubsite \
46-
--src-path "${{ github.workspace }}" \
47-
--type zip
50+
app-name: pubsite
51+
package: .

0 commit comments

Comments
 (0)