Skip to content

Commit 1325004

Browse files
authored
Update dotnet-desktop.yml
1 parent c73d856 commit 1325004

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

.github/workflows/dotnet-desktop.yml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ permissions:
1717

1818
on:
1919
push:
20-
branches: [ "master" ]
20+
branches: ["master"]
2121
pull_request:
22-
branches: [ "master" ]
22+
branches: ["master"]
2323
release:
2424
types: [created]
2525

@@ -33,22 +33,33 @@ jobs:
3333
uses: actions/checkout@v4
3434
with:
3535
fetch-depth: 0
36-
36+
3737
- name: Install .NET Core
3838
uses: actions/setup-dotnet@v4
3939
with:
4040
dotnet-version: 9.0.x
41-
41+
4242
- name: Publish Application for Windows
43+
shell: pwsh
4344
run: |
44-
dotnet publish ${{ env.Project_Path }} -c Release --self-contained true --runtime win-x64 -- -p:PublishSingleFile=true -p:PublishReadyToRun=true -p:PublishTrimmed=true
45-
env:
46-
Configuration: Release
45+
$args = @(
46+
$env:Project_Path,
47+
"-c", "Release",
48+
"--self-contained", "true",
49+
"--runtime", "win-x64",
50+
"--",
51+
"-p:PublishSingleFile=true",
52+
"-p:PublishReadyToRun=true",
53+
"-p:PublishTrimmed=true"
54+
)
55+
dotnet publish @args
4756
4857
- name: Stop dotnet process
58+
shell: pwsh
4959
run: taskkill /F /IM dotnet.exe
5060

5161
- name: Archive Windows Build Output
62+
shell: pwsh
5263
run: |
5364
$publishPath = Resolve-Path "**\bin\Release\net8.0\win-x64\publish\"
5465
if (-Not (Test-Path $publishPath)) {
@@ -81,12 +92,12 @@ jobs:
8192
uses: actions/checkout@v4
8293
with:
8394
fetch-depth: 0
84-
95+
8596
- name: Install .NET Core
8697
uses: actions/setup-dotnet@v4
8798
with:
8899
dotnet-version: 9.0.x
89-
100+
90101
- name: Publish Application for Ubuntu
91102
run: |
92103
dotnet publish ${{ env.Project_Path }} -c Release --self-contained true \
@@ -99,7 +110,7 @@ jobs:
99110

100111
- name: Archive Ubuntu Build Output
101112
run: zip -r release-ubuntu.zip **/bin/Release/net8.0/linux-x64/publish/
102-
113+
103114
- name: Upload Build Artifacts (Ubuntu)
104115
uses: actions/upload-artifact@v4
105116
with:
@@ -114,7 +125,7 @@ jobs:
114125
asset_path: release-ubuntu.zip
115126
asset_name: release-ubuntu.zip
116127
asset_content_type: application/zip
117-
128+
118129
build-macos:
119130
runs-on: macos-latest
120131
env:
@@ -124,12 +135,12 @@ jobs:
124135
uses: actions/checkout@v4
125136
with:
126137
fetch-depth: 0
127-
138+
128139
- name: Install .NET Core
129140
uses: actions/setup-dotnet@v4
130141
with:
131142
dotnet-version: 9.0.x
132-
143+
133144
- name: Publish Application for macOS
134145
run: |
135146
dotnet publish ${{ env.Project_Path }} -c Release --self-contained true \
@@ -139,7 +150,7 @@ jobs:
139150

140151
- name: Stop dotnet process
141152
run: pkill dotnet || true
142-
153+
143154
- name: Archive macOS Build Output (Switch Directory)
144155
run: |
145156
# Locate the publish directory; adjust the glob pattern if needed.
@@ -151,7 +162,7 @@ jobs:
151162
cd "$PUBLISH_DIR"
152163
# Create zip file at the root of the workspace; adjust path if necessary.
153164
zip -r ../../../../release-macos.zip .
154-
165+
155166
- name: Upload Build Artifacts (macOS)
156167
uses: actions/upload-artifact@v4
157168
with:

0 commit comments

Comments
 (0)