update version number #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy ASP.Net Core app to Azure Web App - SampleCRUD | |
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- README.md | |
- .vscode/** | |
- .gitignore | |
pull_request: | |
branches: [ main ] | |
paths-ignore: | |
- README.md | |
- .vscode/** | |
- .gitignore | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4.0.0 # Specifying exact version for stability | |
- name: Set up .NET 9 SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '9.x' | |
include-prerelease: true | |
- name: Check .NET version | |
run: dotnet --info | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build with dotnet | |
run: dotnet build --configuration Release --no-restore | |
- name: Publish .NET app | |
run: dotnet publish --configuration Release --output ${{ runner.workspace }}/myapp --no-build | |
- name: Upload artifact for deployment job | |
uses: actions/upload-artifact@v3 | |
with: | |
name: .net-app | |
path: ${{ runner.workspace }}/myapp | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: 'Production' | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v3 | |
with: | |
name: .net-app | |
- name: Login to Azure | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID }} | |
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID }} | |
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID }} | |
- name: Verify Azure Login | |
run: az account show | |
- name: Deploy to Azure Web App | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v3 | |
with: | |
app-name: 'SampleCRUD' | |
package: ${{ runner.workspace }}/myapp | |