Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
View runs Go to file
 
 
Cannot retrieve contributors at this time
name: Deploy WebApp
on:
push:
branches:
- main
paths-ignore:
- '**/*.md'
- '**/*.gitignore'
- '**/*.gitattributes'
- '**/translations.yaml'
workflow_dispatch:
branches:
- main
paths-ignore:
- '**/*.md'
- '**/*.gitignore'
- '**/*.gitattributes'
env:
AZURE_WEBAPP_NAME: sample-ciapproval
AZURE_WEBAPP_PACKAGE_PATH: ./published
CONFIGURATION: Release
DOTNET_CORE_VERSION: 5.0.x
PROJECT_PATH: sample-workflow-deploy/sample-workflow-deploy.csproj
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
DOTNET_ADD_GLOBAL_TOOLS_TO_PATH: false
DOTNET_MULTILEVEL_LOOKUP: 0
jobs:
build:
name: Build
if: github.event_name == 'push' && contains(toJson(github.event.commits), '***NO_CI***') == false && contains(toJson(github.event.commits), '[ci skip]') == false && contains(toJson(github.event.commits), '[skip ci]') == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core SDK ${{ env.DOTNET_CORE_VERSION }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_CORE_VERSION }}
- name: Restore packages
run: dotnet restore "${{ env.PROJECT_PATH }}"
- name: Build app
run: dotnet build "${{ env.PROJECT_PATH }}" --configuration ${{ env.CONFIGURATION }} --no-restore
- name: Test app
run: dotnet test "${{ env.PROJECT_PATH }}" --no-build
- name: Publish app for deploy
run: dotnet publish "${{ env.PROJECT_PATH }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}"
- name: Publish Artifacts
uses: actions/upload-artifact@v1.0.0
with:
name: webapp
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
staging:
needs: build
name: Deploy to staging
environment:
name: staging
url: ${{ steps.deploy_staging.outputs.webapp-url }}
runs-on: ubuntu-latest
steps:
# Download artifacts
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: webapp
# Deploy to App Service Linux
- name: Deploy to Azure WebApp
uses: azure/webapps-deploy@v2
id: deploy_staging
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE }}
slot-name: staging
deploy:
needs: staging
environment:
name: production
url: ${{ steps.deploy_production.outputs.webapp-url }}
name: Deploy to production
runs-on: ubuntu-latest
steps:
# Download artifacts
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: webapp
# Deploy to App Service Linux
- name: Deploy to Azure WebApp
id: deploy_production
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE }}