Skip to content

Commit e47f6b7

Browse files
authored
build: Add GitHub Actions workflow for .NET deployment
1 parent 99382bf commit e47f6b7

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/main.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build, publish and deploy to MonsterASP.NET
2+
on: [push]
3+
4+
jobs:
5+
build_and_deploy:
6+
runs-on: windows-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
10+
- name: Setup .NET 8
11+
uses: actions/setup-dotnet@v4
12+
with:
13+
dotnet-version: 8.0
14+
15+
- name: Install dependencies
16+
run: dotnet restore
17+
18+
- name: Build
19+
run: dotnet build --configuration Release --no-restore
20+
21+
- name: Copy appsettings
22+
shell: pwsh
23+
run: |
24+
Copy-Item .\Inv_Backend_NET\appsettings.Local.json .\Inv_Backend_NET\appsettings.Release.json -Force
25+
26+
- name: Configure appsettings
27+
uses: microsoft/variable-substitution@v1
28+
with:
29+
files: '.\Inv_Backend_NET\appsettings.Release.json'
30+
env:
31+
ConnectionStrings.Inventory-Db: ${{ secrets.INVENTORY_DB_CONNECTION_STRING }}
32+
JwtSettings.Key: ${{ secrets.JWT_SECRET_KEY }}
33+
JwtSettings.Issuer: http://hezbi-inventory-system.runasp.net
34+
JwtSettings.Audience: frontend-inventory-system
35+
36+
- name: Publish
37+
run: dotnet publish Inv_Backend_NET/Inventory_Backend_NET.csproj -C Release --output ./publish --runtime win-x86
38+
39+
- name: Deploy to MonsterASP.NET via WebDeploy
40+
uses: rasmusbuchholdt/simply-web-deploy@2.1.0
41+
with:
42+
website-name: ${{ secrets.WEBSITE_NAME }}
43+
server-computer-name: ${{ secrets.SERVER_COMPUTER_NAME }}
44+
server-username: ${{ secrets.SERVER_USERNAME }}
45+
server-password: ${{ secrets.SERVER_PASSWORD }}

0 commit comments

Comments
 (0)