cleanup #20
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
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy | |
# More GitHub Actions for Azure: https://github.com/Azure/actions | |
name: Deploy | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
8.0.x | |
- name: Cache nuget packages | |
id: cache-nuget | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.nuget/packages | |
**/obj/* | |
key: ${{ runner.os }}-nuget_obj-${{ hashFiles('**/*.csproj', 'global.json', 'Directory.Build.props') }} | |
- name: Restore dependencies | |
if: steps.cache-nuget.outputs.cache-hit != 'true' | |
run: dotnet restore | |
- name: Check code formatting | |
run: dotnet format --no-restore --verify-no-changes -v diag | |
- name: Build | |
run: dotnet build --no-restore --configuration Release | |
- name: Test | |
run: > | |
dotnet test | |
--no-build | |
--configuration Release | |
--verbosity normal | |
--logger GitHubActions | |
-- | |
RunConfiguration.CollectSourceInformation=true | |
- name: dotnet publish | |
working-directory: CleanAspCore | |
run: dotnet publish --no-build -c Release -o ${{env.DOTNET_ROOT}}/myapp | |
- name: Upload artifact for deployment job | |
uses: actions/upload-artifact@v4 | |
with: | |
name: .net-app | |
path: ${{env.DOTNET_ROOT}}/myapp | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: 'Production' | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
permissions: | |
id-token: write #This is required for requesting the JWT | |
steps: | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v4 | |
with: | |
name: .net-app | |
- name: Login to Azure | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_31E89D4A502E469CBD66ABFE18CA6A81 }} | |
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_9315A3E47D40462BBD348AAFDABA3562 }} | |
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_EE48569817B04F868AACDFB009F565FF }} | |
- name: Deploy to Azure Web App | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: 'rubbed-app' | |
slot-name: 'Production' | |
package: . | |