Merge pull request #20 from ordercloud-api/amrarick26-patch-1 #26
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: | |
workflow_dispatch: | |
push: | |
branches: [ "dev" ] | |
env: | |
AZURE_APP_NAME: 'headstartdemo-middleware ' # change this to your web app name | |
AZURE_SLOT_NAME: 'checkout-integrations' # change this to your slot name | |
DOTNET_VERSION: '6.0.x' | |
API_PROJECT_PATH: './Customer.OrderCloud.Api/Customer.OrderCloud.Api.csproj' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: ${{env.DOTNET_VERSION}} | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Test | |
run: dotnet test --no-build --verbosity normal | |
- name: Publish | |
run: dotnet publish ${{env.API_PROJECT_PATH}} -c Release -o website | |
- name: Upload a Build Artifact | |
uses: actions/[email protected] | |
with: | |
name: website | |
path: ./website/** | |
if-no-files-found: error | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download a Build Artifact | |
uses: actions/[email protected] | |
with: | |
name: website | |
path: website | |
- name: Deploy web app | |
id: deploywebapp | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ env.AZURE_APP_NAME }} | |
slot-name: ${{ env.AZURE_SLOT_NAME }} | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} # Define secret variable in repository settings | |
package: website | |