Skip to content

Commit 4028f0c

Browse files
authored
Update main_your-app-name.yml
1 parent c7ad9da commit 4028f0c

1 file changed

Lines changed: 30 additions & 13 deletions

File tree

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
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 ASP.Net Core app to Azure Web App - your-app-name
1+
name: Build, Test and Deploy ASP.Net Core app to Azure Web App - your-app-name
52

63
on:
74
push:
@@ -13,7 +10,7 @@ jobs:
1310
build:
1411
runs-on: ubuntu-latest
1512
permissions:
16-
contents: read #This is required for actions/checkout
13+
contents: read # requis pour actions/checkout
1714

1815
steps:
1916
- uses: actions/checkout@v4
@@ -23,25 +20,45 @@ jobs:
2320
with:
2421
dotnet-version: '8.0'
2522

23+
- name: Restore dependencies
24+
run: dotnet restore
25+
2626
- name: Build with dotnet
27-
run: dotnet build --configuration Release
27+
run: dotnet build --configuration Release --no-restore
2828

29-
- name: dotnet publish
29+
- name: Publish app
3030
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
3131

32-
- name: Upload artifact for deployment job
32+
- name: Upload artifact for next jobs
3333
uses: actions/upload-artifact@v4
3434
with:
3535
name: .net-app
3636
path: ${{env.DOTNET_ROOT}}/myapp
3737

38-
deploy:
38+
test:
3939
runs-on: ubuntu-latest
4040
needs: build
41-
environment:
42-
name: 'Production'
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- name: Set up .NET Core
45+
uses: actions/setup-dotnet@v4
46+
with:
47+
dotnet-version: '8.0'
48+
49+
- name: Restore dependencies
50+
run: dotnet restore
51+
52+
- name: Run tests
53+
run: dotnet test --no-build --verbosity normal
54+
55+
deploy:
56+
runs-on: ubuntu-latest
57+
needs: [build, test] # Ne s’exécute que si build et test réussissent
58+
environment:
59+
name: 'Production'
4360
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
44-
61+
4562
steps:
4663
- name: Download artifact from build job
4764
uses: actions/download-artifact@v4
@@ -55,4 +72,4 @@ jobs:
5572
app-name: 'your-app-name'
5673
slot-name: 'Production'
5774
package: .
58-
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_4BB9B797473748639415218DA8C649AD }}
75+
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_4BB9B797473748639415218DA8C649AD }}

0 commit comments

Comments
 (0)