Created
August 20, 2020 15:58
-
-
Save tcmorris/dada56a630316670a064882a2753f04f to your computer and use it in GitHub Desktop.
Example GitHub Action for building and deploying a .NET Core app to Azure.
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 to Azure | |
on: [push] | |
env: | |
PROJECT_DIR: yourapp/path | |
AZURE_WEBAPP_NAME: yourapp-name | |
DOTNET_VERSION: '2.2.402' | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repo | |
- uses: actions/checkout@master | |
# Setup .NET Core SDK | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
# Run dotnet build and publish | |
- name: dotnet build and publish | |
run: | | |
cd ${{ env.PROJECT_DIR }} | |
dotnet build --configuration Release | |
dotnet publish -c Release -o publish | |
# Deploy to Azure Web apps | |
- name: 'Run Azure webapp deploy action using publish profile' | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
package: '${{ env.PROJECT_DIR }}/publish' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment