Skip to content

Commit ceb4c06

Browse files
committed
modified ci.yml
1 parent fa413bb commit ceb4c06

File tree

1 file changed

+17
-103
lines changed

1 file changed

+17
-103
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,25 @@
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-
name: Build and deploy to Azure App Services
5-
61
on:
7-
push:
2+
pull_request:
83
branches:
9-
- user/vchintalapat/github-actions-test
10-
schedule:
11-
- cron: "0 0/3 * * *"
4+
- master
125

136
jobs:
14-
build-and-deploy-dotnet-app:
15-
runs-on: ubuntu-latest
16-
17-
permissions:
18-
id-token: write
19-
20-
steps:
21-
- uses: actions/checkout@v4
22-
23-
- name: Modify the sample app
24-
run: |
25-
cp -r ./__tests__/dotnetsampleapp dotnetapp
26-
current_utc_time=$(date -u +"%Y-%m-%d %H:%M:%S %Z")
27-
sed -i "s/<<<net-place-holder>>>/$current_utc_time/g" dotnetapp/Controllers/HelloController.cs
28-
29-
echo "The placeholder has been replaced with current UTC time: $current_utc_time"
30-
31-
- name: Set up .NET Core
32-
uses: actions/setup-dotnet@v4
33-
with:
34-
dotnet-version: '8.x'
35-
36-
- name: Build with dotnet
37-
run: dotnet build --configuration Release dotnetapp/DOTNET_8_APP.csproj
38-
39-
- name: dotnet publish
40-
run: dotnet publish dotnetapp/DOTNET_8_APP.csproj -c Release -o myapp
41-
42-
- name: Upload artifact for deployment job
43-
uses: actions/upload-artifact@v4
44-
with:
45-
name: .net-app
46-
path: myapp
47-
48-
- name: Login to Azure
49-
uses: azure/login@v2
50-
with:
51-
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_DOTNETAPP1 }}
52-
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID }}
53-
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID }}
54-
55-
- name: Deploy to Azure Web App
56-
id: deploy-to-webapp
57-
uses: azure/webapps-deploy@v3
58-
with:
59-
app-name: 'lwasv2-euap-dotnet-githubactionstest'
60-
slot-name: 'Production'
61-
package: myapp
62-
63-
build-and-deploy-node-app:
64-
runs-on: ubuntu-latest
65-
66-
permissions:
67-
id-token: write
68-
7+
build_test_job:
8+
name: 'Build and test job'
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
os: [windows-latest, ubuntu-latest, macos-latest]
6913
steps:
70-
- uses: actions/checkout@v4
71-
72-
- name: modify Node.js App
73-
run: |
74-
cp -r ./__tests__/nodesampleapp nodeapp
75-
current_utc_time=$(date -u +"%Y-%m-%d %H:%M:%S %Z")
76-
sed -i "s/<<<node-place-holder>>>/$current_utc_time/g" nodeapp/server.js
77-
78-
echo "The placeholder has been replaced with current UTC time: $current_utc_time"
79-
80-
- name: Set up Node.js version
81-
uses: actions/setup-node@v3
82-
with:
83-
node-version: '18.x'
8414

85-
- name: npm install, build, and test
86-
run: |
87-
cd nodeapp
88-
npm install
89-
npm run build --if-present
90-
npm run test --if-present
15+
- name: 'Checking out repo code'
16+
uses: actions/checkout@v2
9117

92-
- name: Upload artifact for deployment job
93-
uses: actions/upload-artifact@v4
94-
with:
95-
name: node-app
96-
path: nodeapp
18+
- name: 'Validate build'
19+
run: |
20+
npm install
21+
npm run build
9722
98-
- name: Login to Azure
99-
uses: azure/login@v2
100-
with:
101-
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_NODEAPP1 }}
102-
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID }}
103-
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID }}
104-
105-
- name: 'Deploy to Azure Web App'
106-
id: deploy-to-webapp
107-
uses: azure/webapps-deploy@v3
108-
with:
109-
app-name: 'lwasv2-euap-node-githubactions'
110-
slot-name: 'Production'
111-
package: nodeapp
23+
- name: 'Run L0 tests'
24+
run: |
25+
npm run test

0 commit comments

Comments
 (0)