-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-deploy.yml
50 lines (40 loc) · 1.35 KB
/
azure-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Deploy to Azure Web App
on:
push:
branches:
- main # or any branch you code is on
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20' # or the version of node your app is using
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Log in to ACR
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push image to ACR
env:
REGISTRY_LOGIN_SERVER: ${{ secrets.REGISTRY_LOGIN_SERVER }}
run: |
docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/nextjs-app:${{ github.sha }}
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/nextjs-app:${{ github.sha }}
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: ${{ secrets.AZURE_WEBAPP_NAME }}
images: ${{ secrets.REGISTRY_LOGIN_SERVER }}/nextjs-app:${{ github.sha }}
- name: Azure logout
run: |
az logout