@KingJava :
You can try the below mentioned YML script which uses publish profile details of web app. to deploy. Setup the publish profile as a secret and your done.
The script is deploying when "Triggered". If you have a continuous job change that folder to "Continuous".
https://github.com/Azure/webapps-deploy/issues/3
name: Deploy WebJob
on:
workflow_dispatch:
push:
branches: [ develop ]
env:
WEBJOB_NAME: YourWebJobName
AZURE_APP_NAME: your-azure-app-service-name
PROJECT_ROOT: path/to/your/Project.Root
TEST_PROJECT_ROOT: path/to/your/Project.Root.Tests
DOTNET_VERSION: '3.1.x'
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the repo
- uses: actions/checkout@v2
# Setup .NET Core SDK
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: dotnet test
run: |
dotnet test ${{ env.TEST_PROJECT_ROOT }}
- name: dotnet publish
run: |
dotnet publish -c Release -o './publish/App_Data/Jobs/Triggered/${{ env.WEBJOB_NAME }}' ${{ env.PROJECT_ROOT }}
- name: Deploy to Azure App Service
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_APP_NAME }}
publish-profile: ${{ secrets.PUBLISH_PROFILE }}
package: './publish'