1
- # Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
2
- # More GitHub Actions for Azure: https://github.com/Azure/actions
3
-
4
1
name : Build and deploy Node.js app to Azure Web App - devpr
5
2
6
3
on :
7
4
push :
8
5
branches :
9
6
- main
10
7
workflow_dispatch :
8
+ inputs :
9
+ deploy_front :
10
+ description : ' Mark this checkbox to deploy and build the front-end'
11
+ required : true
12
+ default : false
13
+ type : boolean
11
14
12
15
jobs :
13
- build :
16
+ build-deploy-front :
17
+ if : github.event_name != 'workflow_dispatch' || github.event.inputs.deploy_front == true
14
18
runs-on : ubuntu-latest
15
19
permissions :
16
20
contents : write
17
- id-token : write # needed for provenance data generation
21
+ id-token : write
18
22
timeout-minutes : 10
19
23
steps :
20
24
- uses : actions/checkout@v4
27
31
version : 9.12.1
28
32
29
33
- name : Install Node
30
- # Cache node_modules
31
34
uses : actions/setup-node@v4
32
35
with :
33
36
node-version : 20
@@ -38,45 +41,53 @@ jobs:
38
41
39
42
- uses : nrwl/nx-set-shas@v4
40
43
41
- - run : pnpm exec nx run-many -t build --projects server, devmx --configuration=production --parallel 10
44
+ - run : pnpm exec nx run-many -t build --projects devmx --configuration=production --parallel 10
42
45
43
46
- name : Deploy GitHub Pages
44
47
uses : peaceiris/actions-gh-pages@v3
45
48
with :
46
49
github_token : ${{ secrets.GITHUB_TOKEN }}
47
50
publish_dir : ./dist/apps/devmx/browser
48
51
49
- - name : Zip artifact for deployment
50
- run : |
51
- cd dist/apps/server && zip -r release.zip ./*
52
-
53
- - name : Upload artifact for deployment job
54
- uses : actions/upload-artifact@v3
52
+ build-back :
53
+ runs-on : ubuntu-latest
54
+ permissions :
55
+ contents : write
56
+ id-token : write
57
+ timeout-minutes : 10
58
+ steps :
59
+ - uses : actions/checkout@v4
60
+
61
+ - name : Set up Docker Buildx
62
+ uses : docker/setup-buildx-action@v2
63
+
64
+ - name : Log in to registry
65
+ uses : docker/login-action@v2
66
+ with :
67
+ registry : https://devmx.azurecr.io/
68
+ username : ${{ secrets.AzureAppService_ContainerUsername_947982706eed46ce985090481ab47364 }}
69
+ password : ${{ secrets.AzureAppService_ContainerPassword_86f3c94c1b5143be904bfc1de2add431 }}
70
+
71
+ - name : Build and push container image to registry
72
+ uses : docker/build-push-action@v3
55
73
with :
56
- name : node-app
57
- path : ./dist/apps/server/release.zip
74
+ push : true
75
+ tags : devmx.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_947982706eed46ce985090481ab47364 }}/devmx-server:${{ github.sha }}
76
+ file : ./Dockerfile.server
58
77
59
78
deploy :
60
79
runs-on : ubuntu-latest
61
- needs : build
80
+ needs : build-back
62
81
environment :
63
- name : ' Production '
82
+ name : ' production '
64
83
url : ${{ steps.deploy-to-webapp.outputs.webapp-url }}
65
84
66
85
steps :
67
- - name : Download artifact from build job
68
- uses : actions/download-artifact@v3
69
- with :
70
- name : node-app
71
-
72
- - name : Unzip artifact for deployment
73
- run : unzip release.zip
74
-
75
- - name : ' Deploy to Azure Web App'
76
- id : deploy-to-webapp
77
- uses : azure/webapps-deploy@v2
78
- with :
79
- app-name : ' devpr'
80
- slot-name : ' Production'
81
- publish-profile : ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_AF340B23D99E4DE5BE0B99FA4D5BFB80 }}
82
- package : .
86
+ - name : Deploy to Azure Web App
87
+ id : deploy-to-webapp
88
+ uses : azure/webapps-deploy@v2
89
+ with :
90
+ app-name : ' devpr'
91
+ slot-name : ' production'
92
+ publish-profile : ${{ secrets.AzureAppService_PublishProfile_36a287a711bf47e6a54130170298549c }}
93
+ images : ' devmx.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_947982706eed46ce985090481ab47364 }}/devmx-server:${{ github.sha }}'
0 commit comments