I am trying to deploy a small WebApp with GitHub Actions into an Azure WebApp deployment slot. The WebApp in Azure is called webappdeploydemo and the deployment slot development. The WebApp is based on .NET 6 LTS stack.
For this I use an ubuntu runner and the following YAML-configuration:
name: 'Deploy to Azure App Service'
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
AZURE_WEBAPP_PACKAGE_PATH: '.'
AZURE_WEBAPP_NAME: webappdeploydemo
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Build
run: dotnet build --configuration Release
- name: Publish
run: dotnet publish -c Release -o '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapplication'
- name: Deploy
uses: Azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
slot-name: 'development'
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapplication'
When triggering the GitHub Action I have an error at the build step, which I am trying to understand and solve. In understood that it can't find a sln or .net project at that path. But why and how can I overcome this?
CodePudding user response:
I am able to create a development slot without any issues. Please follow the below steps.
Make sure your source files are deployed properly to GitHub. Check the folder structure before you continue the steps.
- In Visual Studio, Create a
.NET Core 6Web App. - Push the code to GitHub Repository.
- New files
.gitattributesand.gitignorewill be created in the GitHub Repo along with the Source Code.

- Make sure your
GitRepositoryhas all the required solution and folder structure.

- Create a new App Service.

- Enable
Continuous deploymentfor GitHub Actions.

- Workflow folder will be created in the GitHub Repo.

Output:

Creating Deployment Slots:
In
Azure Portal=> Navigate to yourApp Service=> selectDeployment slotsUnderDeployment.As we have deployed the Application to Azure, we will find one
Production slot.

Create one
developmentslot. Provide the name and select the deployed App Service to clone all the deployed configurations and settings todevelopmentslot fromProductionslot.

As it is a sample App, it takes few seconds to create the slot.

- Check the newly created
development slotunderAll Resources.

Initial Output of Development Slot:

- Now we need to set the
continuous deploymentand integrate theGitHub Repocode. - In Visual Studio, create a new branch for
Development.

- Commit and push the changes of new branch.

- In GitHub, click on
View all branches, you will find a new branch.

- Navigate to the
Development slot. Now integrate the GitHubdevelopment branchfor thedevelopment slotand click onSave.

Final Output for Development Slot:


