Skip to content

Commit ecb7598

Browse files
authored
Revise GitHub Actions workflow for musicostore
Updated .NET version and improved workflow steps for building and deploying the ASP.NET Core app.
1 parent 735af12 commit ecb7598

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed
Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and deploy ASP.Net Core app to Azure Web App - musicostore
1+
name: Build and deploy .NET Core app to Azure Web App - musicostore
22

33
on:
44
push:
@@ -9,41 +9,44 @@ on:
99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12-
permissions:
13-
contents: read
14-
1512
steps:
1613
- uses: actions/checkout@v4
1714

18-
- name: Set up .NET
15+
- name: Set up .NET Core
1916
uses: actions/setup-dotnet@v4
2017
with:
21-
dotnet-version: '10.0.x'
18+
dotnet-version: '8.0.x' # Ensure this matches your project (e.g., 6.0, 7.0, or 8.0)
19+
20+
- name: Restore dependencies
21+
run: dotnet restore
2222

23-
- name: Build solution
24-
run: dotnet build MusicoStore.sln -c Release
23+
- name: Build
24+
run: dotnet build --configuration Release --no-restore
2525

26-
- name: Publish WebMVC
27-
run: dotnet publish src/MusicoStore.WebMVC/MusicoStore.WebMVC.csproj -c Release -o ${{env.DOTNET_ROOT}}/myapp
26+
- name: Publish
27+
run: dotnet publish src/MusicoStore.WebMVC/MusicoStore.WebMVC.csproj -c Release -o ./publish
2828

29-
- name: Upload artifact
29+
- name: Upload artifact for deployment job
3030
uses: actions/upload-artifact@v4
3131
with:
32-
name: app
33-
path: ${{env.DOTNET_ROOT}}/myapp
32+
name: webapp
33+
path: ./publish
3434

3535
deploy:
3636
runs-on: ubuntu-latest
3737
needs: build
38+
environment:
39+
name: 'Production' # Force it to Production to avoid Slot 404 errors
3840
permissions:
3941
id-token: write
4042
contents: read
4143

4244
steps:
43-
- name: Download artifact
45+
- name: Download artifact from build job
4446
uses: actions/download-artifact@v4
4547
with:
46-
name: app
48+
name: webapp
49+
path: ./deploy-package
4750

4851
- name: Login to Azure
4952
uses: azure/login@v2
@@ -56,4 +59,4 @@ jobs:
5659
uses: azure/webapps-deploy@v3
5760
with:
5861
app-name: 'musicostore'
59-
package: .
62+
package: ./deploy-package

0 commit comments

Comments
 (0)