Skip to content

Commit 2042eb1

Browse files
authored
Create main.yml
1 parent 52b2975 commit 2042eb1

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/main.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build and Deploy to Azure Web App Staging
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Or your target branch
7+
8+
jobs:
9+
build-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Setup .NET SDK
17+
uses: actions/setup-dotnet@v3
18+
with:
19+
dotnet-version: '8.x' # Or your target version
20+
21+
- name: Restore dependencies
22+
run: dotnet restore eShopOnWeb.sln
23+
24+
- name: Build solution
25+
run: dotnet build eShopOnWeb.sln --configuration Release --no-restore
26+
27+
- name: Publish Web Project
28+
run: dotnet publish ./src/Web/Web.csproj -c Release -o ./publish/web
29+
30+
- name: Publish PublicAPI Project
31+
run: dotnet publish ./src/PublicApi/PublicApi.csproj -c Release -o ./publish/publicapi
32+
33+
- name: Deploy Web to Azure Staging Slot
34+
uses: azure/webapps-deploy@v2
35+
with:
36+
app-name: 'eshopohweb' # No slot name here
37+
slot-name: 'staging'
38+
publish-profile: ${{ secrets.PUBLISH_PROFILE_ESHOPWEB }}
39+
package: ./publish/web
40+
41+
- name: Deploy PublicAPI to Azure Staging Slot
42+
uses: azure/webapps-deploy@v2
43+
with:
44+
app-name: 'eshopwebapiapp'
45+
slot-name: 'staging'
46+
publish-profile: ${{ secrets.PUBLISH_PROFILE_ESHOPWEBAPI }}
47+
package: ./publish/publicapi

0 commit comments

Comments
 (0)