formatted workflows
هذا الالتزام موجود في:
128
.github/workflows/10-dotnet.yml
مباع
128
.github/workflows/10-dotnet.yml
مباع
@@ -3,12 +3,12 @@ name: 10 .NET
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ main ]
|
||||
branches: [main]
|
||||
paths:
|
||||
- '!**'
|
||||
- 'dotnet-sample/**'
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
branches: [main]
|
||||
paths:
|
||||
- '!**'
|
||||
- 'dotnet-sample/**'
|
||||
@@ -23,44 +23,43 @@ defaults:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 7.0.x
|
||||
- name: Set up dependency caching for faster builds
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nuget-
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 7.0.x
|
||||
- name: Set up dependency caching for faster builds
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nuget-
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build --configuration Release --no-restore
|
||||
- name: Test
|
||||
run: dotnet test --no-build --verbosity normal
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build --configuration Release --no-restore
|
||||
- name: Test
|
||||
run: dotnet test --no-build --verbosity normal
|
||||
|
||||
- name: dotnet publish
|
||||
run: dotnet publish -c Release -o ./webapp
|
||||
- name: dotnet publish
|
||||
run: dotnet publish -c Release -o ./webapp
|
||||
|
||||
- name: Upload artifact for deployment job
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: webapp
|
||||
path: ./dotnet-sample/webapp
|
||||
- name: Upload artifact for deployment job
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: webapp
|
||||
path: ./dotnet-sample/webapp
|
||||
|
||||
- name: Upload artifact for deployment job
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: iac
|
||||
path: ./dotnet-sample/iac
|
||||
- name: Upload artifact for deployment job
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: iac
|
||||
path: ./dotnet-sample/iac
|
||||
|
||||
deploy-webapp:
|
||||
needs: [build]
|
||||
@@ -68,39 +67,38 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Checkout code
|
||||
- name: Download IaC
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: iac
|
||||
path: iac
|
||||
- name: Download IaC
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: iac
|
||||
path: iac
|
||||
|
||||
# Log into Azure
|
||||
- uses: azure/login@v1
|
||||
name: Sign in to Azure
|
||||
with:
|
||||
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||
# Log into Azure
|
||||
- uses: azure/login@v1
|
||||
name: Sign in to Azure
|
||||
with:
|
||||
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||
|
||||
# Deploy Bicep file
|
||||
- name: deploy
|
||||
id: deploy
|
||||
uses: azure/arm-deploy@v1
|
||||
with:
|
||||
resourceGroupName: ${{ secrets.AZURE_RG }}
|
||||
template: ./iac/main.bicep
|
||||
parameters: webAppName=${{ secrets.AZURE_APP_NAME }}
|
||||
failOnStdErr: false
|
||||
|
||||
- name: Download App
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: webapp
|
||||
path: webapp
|
||||
# Deploy Bicep file
|
||||
- name: deploy
|
||||
id: deploy
|
||||
uses: azure/arm-deploy@v1
|
||||
with:
|
||||
resourceGroupName: ${{ secrets.AZURE_RG }}
|
||||
template: ./iac/main.bicep
|
||||
parameters: webAppName=${{ secrets.AZURE_APP_NAME }}
|
||||
failOnStdErr: false
|
||||
|
||||
- name: 'Run Azure webapp deploy action using publish profile credentials'
|
||||
uses: azure/webapps-deploy@v2
|
||||
with:
|
||||
app-name: ${{ steps.deploy.outputs.webAppName }} # Replace with your app name
|
||||
package: 'webapp'
|
||||
- name: Download App
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: webapp
|
||||
path: webapp
|
||||
|
||||
- name: 'Run Azure webapp deploy action using publish profile credentials'
|
||||
uses: azure/webapps-deploy@v2
|
||||
with:
|
||||
app-name: ${{ steps.deploy.outputs.webAppName }} # Replace with your app name
|
||||
package: 'webapp'
|
||||
|
المرجع في مشكلة جديدة
حظر مستخدم