@@ -13,10 +13,11 @@ permissions:
1313 security-events : write
1414
1515env :
16- AZURE_WEBAPP_NAME : app-gh-aspnet-webapp-01 # set this to your application's name
17- SRC_PROJECT_PATH : ' /webapp01/webapp01.csproj'
18- AZURE_WEBAPP_PACKAGE_PATH : ' ./src' # set this to the path to your web app project, defaults to the repository root
19- DOTNET_VERSION : ' 9.0.x' # set this to the dot net version to use
16+ AZURE_WEBAPP_NAME : app-gh-aspnet-webapp-01 # set this to your application's name
17+ SRC_PROJECT_PATH : " /webapp01/webapp01.csproj"
18+ AZURE_WEBAPP_PACKAGE_PATH : " ./src" # set this to the path to your web app project, defaults to the repository root
19+ DOTNET_VERSION : " 9.0.x" # set this to the dot net version to use
20+ AZURE_ACR_NAME : crdevsecopscldev01 # set this to your Azure Container Registry name
2021
2122jobs :
2223 cicd :
@@ -25,55 +26,55 @@ jobs:
2526 steps :
2627 # Checkout the repo
2728 - uses : actions/checkout@v5
28-
29+
2930 # Setup .NET Core SDK
3031 - name : Setup .NET Core
3132 uses : actions/setup-dotnet@v4
3233 with :
33- dotnet-version : ${{ env.DOTNET_VERSION }}
34-
34+ dotnet-version : ${{ env.DOTNET_VERSION }}
35+
3536 # Run dotnet build and publish
3637 - name : dotnet build and publish
3738 run : |
3839 dotnet restore ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}${{ env.SRC_PROJECT_PATH }}
3940 dotnet build --configuration Release ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}${{ env.SRC_PROJECT_PATH }}
4041 dotnet publish -c Release --property:PublishDir='bin/publish' ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}${{ env.SRC_PROJECT_PATH }}
41-
42+
4243 - name : Azure Login
4344 uses : azure/login@v2
4445 with :
45- client-id : ${{ secrets.AZURE_CLIENT_ID }}
46- tenant-id : ${{ secrets.AZURE_TENANT_ID }}
47- subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
48-
46+ client-id : ${{ secrets.AZURE_CLIENT_ID }}
47+ tenant-id : ${{ secrets.AZURE_TENANT_ID }}
48+ subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
49+
4950 # Deploy to Azure Web apps
50- - name : ' Run Azure webapp deploy action using publish profile credentials'
51- if : false # This disables the action
51+ - name : " Run Azure webapp deploy action using publish profile credentials"
52+ if : false # This disables the action
5253 uses : azure/webapps-deploy@v3
53- with :
54+ with :
5455 app-name : ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name
55- package : ' ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/webapp01/bin/publish'
56-
56+ package : " ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/webapp01/bin/publish"
57+
5758 - uses : azure/docker-login@v2
5859 with :
59- login-server : crdevsecopscldev .azurecr.io
60+ login-server : ${{ env.AZURE_ACR_NAME }} .azurecr.io
6061 username : ${{ secrets.REGISTRY_USERNAME }}
6162 password : ${{ secrets.REGISTRY_PASSWORD }}
6263 - run : |
63- docker build ./src/webapp01 --file ./src/webapp01/Dockerfile -t crdevsecopscldev .azurecr.io/webapp01:${{ github.sha }}
64- docker push crdevsecopscldev. azurecr.io/webapp01:${{ github.sha }}
65-
64+ docker build ./src/webapp01 --file ./src/webapp01/Dockerfile -t ${{ env.AZURE_ACR_NAME }} .azurecr.io/webapp01:${{ github.sha }}
65+ docker push ${{ env.AZURE_ACR_NAME }}. azurecr.io/webapp01:${{ github.sha }}
66+
6667 - name : Azure Web Apps Deploy
6768 uses : azure/webapps-deploy@v3
6869 with :
6970 app-name : ${{ env.AZURE_WEBAPP_NAME }}
70- images : ' crdevsecopscldev. azurecr.io/webapp01:${{ github.sha }}'
71-
71+ images : " ${{ env.AZURE_ACR_NAME }}. azurecr.io/webapp01:${{ github.sha }}"
72+
7273 - name : logout
7374 run : |
7475 az logout
75-
76- # https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-and-reusable-workflows-to-achieve-slsa-v1-build-level-3
76+
77+ # https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-and-reusable-workflows-to-achieve-slsa-v1-build-level-3
7778 container-build-publish :
7879 name : Build and Publish Container Image
7980 needs : []
8384 version : v1.0.0
8485 container-file : ./src/webapp01/Dockerfile
8586 container-context : ./src/webapp01
86- container-name : " ${{ github.repository }}/webapp01"
87+ container-name : " ${{ github.repository }}/webapp01"
0 commit comments