Skip to content

Commit e24fde1

Browse files
authored
fix: use BuildSingleTarget for CI platform builds (#52)
2 parents f00379d + 1c85730 commit e24fde1

2 files changed

Lines changed: 13 additions & 20 deletions

File tree

.github/workflows/buildrelease.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ jobs:
118118
echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > tfmaudio.keystore
119119
echo "ANDROID_KEYSTORE_PATH=$(pwd)/tfmaudio.keystore" >> $GITHUB_ENV
120120
121-
- name: '📦 Restore Android dependencies'
122-
run: |
123-
dotnet restore TFMAudioApp/TFMAudioApp.csproj /p:TargetFramework=net9.0-android
124-
125121
- name: '🔨 Build Android APK (Signed)'
126122
if: ${{ env.ANDROID_KEYSTORE_PATH != '' }}
127123
env:
@@ -133,9 +129,9 @@ jobs:
133129
VERSION_CODE=${{ steps.version.outputs.version_code }}
134130
135131
dotnet publish TFMAudioApp/TFMAudioApp.csproj \
136-
--no-restore \
137132
-c Release \
138133
-f net9.0-android \
134+
-p:BuildSingleTarget=android \
139135
-p:ApplicationDisplayVersion=$VERSION \
140136
-p:ApplicationVersion=$VERSION_CODE \
141137
-p:AndroidKeyStore=true \
@@ -152,9 +148,9 @@ jobs:
152148
153149
echo "⚠️ Building unsigned APK (no keystore configured)"
154150
dotnet publish TFMAudioApp/TFMAudioApp.csproj \
155-
--no-restore \
156151
-c Release \
157152
-f net9.0-android \
153+
-p:BuildSingleTarget=android \
158154
-p:ApplicationDisplayVersion=$VERSION \
159155
-p:ApplicationVersion=$VERSION_CODE
160156
@@ -214,18 +210,14 @@ jobs:
214210
echo "version=$VERSION" >> $GITHUB_OUTPUT
215211
echo "tag=$TAG" >> $GITHUB_OUTPUT
216212
217-
- name: '📦 Restore Windows dependencies'
218-
run: |
219-
dotnet restore TFMAudioApp/TFMAudioApp.csproj /p:TargetFramework=net9.0-windows10.0.19041.0
220-
221213
- name: '🔨 Build Windows App'
222214
run: |
223215
$VERSION = "${{ steps.version.outputs.version }}"
224216
225217
dotnet publish TFMAudioApp/TFMAudioApp.csproj `
226-
--no-restore `
227218
-c Release `
228219
-f net9.0-windows10.0.19041.0 `
220+
-p:BuildSingleTarget=windows `
229221
-p:ApplicationDisplayVersion=$VERSION `
230222
-p:WindowsPackageType=None `
231223
-p:PublishSingleFile=false `
@@ -318,19 +310,15 @@ jobs:
318310
echo "version=$VERSION" >> $GITHUB_OUTPUT
319311
echo "tag=$TAG" >> $GITHUB_OUTPUT
320312
321-
- name: '📦 Restore macOS dependencies'
322-
run: |
323-
dotnet restore TFMAudioApp/TFMAudioApp.csproj /p:TargetFramework=net9.0-maccatalyst
324-
325313
- name: '🔨 Build macOS App (Intel x64)'
326314
run: |
327315
VERSION=${{ steps.version.outputs.version }}
328316
329317
dotnet publish TFMAudioApp/TFMAudioApp.csproj \
330-
--no-restore \
331318
-c Release \
332319
-f net9.0-maccatalyst \
333320
-r maccatalyst-x64 \
321+
-p:BuildSingleTarget=maccatalyst \
334322
-p:ApplicationDisplayVersion=$VERSION \
335323
-p:CreatePackage=true \
336324
-o bin/macos-x64
@@ -340,10 +328,10 @@ jobs:
340328
VERSION=${{ steps.version.outputs.version }}
341329
342330
dotnet publish TFMAudioApp/TFMAudioApp.csproj \
343-
--no-restore \
344331
-c Release \
345332
-f net9.0-maccatalyst \
346333
-r maccatalyst-arm64 \
334+
-p:BuildSingleTarget=maccatalyst \
347335
-p:ApplicationDisplayVersion=$VERSION \
348336
-p:CreatePackage=true \
349337
-o bin/macos-arm64

TFMAudioApp/TFMAudioApp.csproj

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010
Workloads needed:
1111
- dotnet workload install android
1212
- dotnet workload install maui (includes maccatalyst on Mac)
13+
14+
For CI builds, use -p:BuildSingleTarget=android|windows|maccatalyst
1315
-->
14-
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">net9.0-android;net9.0-windows10.0.19041.0</TargetFrameworks>
15-
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('osx'))">net9.0-android;net9.0-maccatalyst</TargetFrameworks>
16-
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('linux'))">net9.0-android</TargetFrameworks>
16+
<TargetFrameworks Condition="'$(BuildSingleTarget)' == 'android'">net9.0-android</TargetFrameworks>
17+
<TargetFrameworks Condition="'$(BuildSingleTarget)' == 'windows'">net9.0-windows10.0.19041.0</TargetFrameworks>
18+
<TargetFrameworks Condition="'$(BuildSingleTarget)' == 'maccatalyst'">net9.0-maccatalyst</TargetFrameworks>
19+
<TargetFrameworks Condition="'$(BuildSingleTarget)' == '' and $([MSBuild]::IsOSPlatform('windows'))">net9.0-android;net9.0-windows10.0.19041.0</TargetFrameworks>
20+
<TargetFrameworks Condition="'$(BuildSingleTarget)' == '' and $([MSBuild]::IsOSPlatform('osx'))">net9.0-android;net9.0-maccatalyst</TargetFrameworks>
21+
<TargetFrameworks Condition="'$(BuildSingleTarget)' == '' and $([MSBuild]::IsOSPlatform('linux'))">net9.0-android</TargetFrameworks>
1722

1823
<OutputType>Exe</OutputType>
1924
<RootNamespace>TFMAudioApp</RootNamespace>

0 commit comments

Comments
 (0)