Skip to content

Commit e597552

Browse files
committed
build(macOS): fix watchdog on osx-x64
1 parent 96c3b4c commit e597552

File tree

6 files changed

+70
-36
lines changed

6 files changed

+70
-36
lines changed

.github/workflows/linux-release.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
tags:
66
- 'v*.*.*'
7+
workflow_dispatch:
78

89
jobs:
910
build-linux:
@@ -27,6 +28,18 @@ jobs:
2728
submodules: true
2829
lfs: true
2930

31+
- name: Verify Tag (Manual Trigger)
32+
if: github.event_name == 'workflow_dispatch'
33+
run: |
34+
TAG=$(git describe --exact-match --tags HEAD 2>/dev/null || echo "")
35+
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
36+
echo "Error: Current commit is not tagged with a valid version (vX.X.X)."
37+
echo "Current tag: $TAG"
38+
exit 1
39+
fi
40+
echo "Found valid tag: $TAG"
41+
echo "GITHUB_REF=refs/tags/$TAG" >> $GITHUB_ENV
42+
3043
- name: Get version from tag
3144
id: get_version
3245
run: |

.github/workflows/macos-release.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
tags:
66
- 'v*.*.*'
7+
workflow_dispatch:
78

89
jobs:
910
build-mac:
@@ -24,6 +25,18 @@ jobs:
2425
submodules: true
2526
lfs: true
2627

28+
- name: Verify Tag (Manual Trigger)
29+
if: github.event_name == 'workflow_dispatch'
30+
run: |
31+
TAG=$(git describe --exact-match --tags HEAD 2>/dev/null || echo "")
32+
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
33+
echo "Error: Current commit is not tagged with a valid version (vX.X.X)."
34+
echo "Current tag: $TAG"
35+
exit 1
36+
fi
37+
echo "Found valid tag: $TAG"
38+
echo "GITHUB_REF=refs/tags/$TAG" >> $GITHUB_ENV
39+
2740
- name: Get version from tag
2841
id: get_version
2942
run: |
@@ -65,7 +78,7 @@ jobs:
6578
run: dotnet workload restore src/Everywhere.Mac/Everywhere.Mac.csproj
6679

6780
- name: Restore
68-
run: dotnet restore Everywhere.Mac.slnf -r ${{ matrix.runtime }}
81+
run: dotnet restore Everywhere.Mac.slnf -r ${{ matrix.runtime }} /p:RuntimeIdentifier=${{ matrix.runtime }}
6982

7083
- name: Publish
7184
env:
@@ -75,6 +88,7 @@ jobs:
7588
dotnet publish src/Everywhere.Mac/Everywhere.Mac.csproj \
7689
-c Release \
7790
-r ${{ matrix.runtime }} \
91+
/p:RuntimeIdentifier=${{ matrix.runtime }} \
7892
/p:CodesignKey="$CODE_SIGN_KEY" \
7993
/p:PackageSigningKey="$PACKAGE_SIGNING_KEY" \
8094
/p:Version=${{ env.VERSION }} \

.github/workflows/windows-release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
tags:
66
- 'v*.*.*'
7+
workflow_dispatch:
78

89
jobs:
910
build-and-release:
@@ -19,6 +20,22 @@ jobs:
1920
fetch-depth: 0
2021
submodules: true
2122
lfs: true
23+
24+
- name: Verify Tag (Manual Trigger)
25+
if: github.event_name == 'workflow_dispatch'
26+
shell: pwsh
27+
run: |
28+
$tag = git describe --exact-match --tags HEAD 2>$null
29+
if ($LASTEXITCODE -ne 0) {
30+
Write-Error "Error: Current commit is not tagged."
31+
exit 1
32+
}
33+
if ($tag -notmatch '^v\d+\.\d+\.\d+') {
34+
Write-Error "Error: Current commit tag '$tag' does not match vX.X.X format."
35+
exit 1
36+
}
37+
Write-Host "Found valid tag: $tag"
38+
echo "GITHUB_REF=refs/tags/$tag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
2239
2340
- name: Get version from tag
2441
id: get_version

Directory.Build.props

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,74 +13,52 @@
1313
<EnableWindowsTargeting>true</EnableWindowsTargeting>
1414
</PropertyGroup>
1515

16-
<PropertyGroup Condition="$([System.String]::Copy($(RuntimeIdentifier)).StartsWith('win')) OR $([MSBuild]::IsOSPlatform('Windows'))">
16+
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
1717
<IsWindows>true</IsWindows>
1818
<DefineConstants>$(DefineConstants);WINDOWS;IsWindows</DefineConstants>
1919
</PropertyGroup>
2020

21-
<PropertyGroup Condition="$([System.String]::Copy($(RuntimeIdentifier)).StartsWith('linux')) OR $([MSBuild]::IsOSPlatform('Linux'))">
21+
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
2222
<IsLinux>true</IsLinux>
2323
<DefineConstants>$(DefineConstants);LINUX;IsLinux</DefineConstants>
2424
</PropertyGroup>
2525

26-
<PropertyGroup Condition="$([System.String]::Copy($(RuntimeIdentifier)).StartsWith('osx')) OR $([MSBuild]::IsOSPlatform('OSX'))">
26+
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
2727
<IsOSX>true</IsOSX>
2828
<IsMacOS>true</IsMacOS>
2929
<DefineConstants>$(DefineConstants);OSX;MACOS;IsOSX;IsMacOS</DefineConstants>
3030
</PropertyGroup>
3131

32-
<PropertyGroup Condition="$([System.String]::Copy($(RuntimeIdentifier)).StartsWith('ios'))">
33-
<IsIOS>true</IsIOS>
34-
<DefineConstants>$(DefineConstants);IOS;IsIOS</DefineConstants>
35-
</PropertyGroup>
36-
37-
<PropertyGroup Condition="$([System.String]::Copy($(RuntimeIdentifier)).StartsWith('android'))">
38-
<IsAndroid>true</IsAndroid>
39-
<DefineConstants>$(DefineConstants);ANDROID;IsAndroid</DefineConstants>
40-
</PropertyGroup>
41-
42-
<PropertyGroup Condition="$([System.String]::Copy($(RuntimeIdentifier)).StartsWith('maccatalyst'))">
43-
<IsMacCatalyst>true</IsMacCatalyst>
44-
<DefineConstants>$(DefineConstants);MACCATALYST;IsMacCatalyst</DefineConstants>
45-
</PropertyGroup>
46-
47-
<PropertyGroup Condition="$([System.String]::Copy($(RuntimeIdentifier)).StartsWith('browser'))">
48-
<IsBrowser>true</IsBrowser>
49-
<IsWasm>true</IsWasm>
50-
<DefineConstants>$(DefineConstants);BROWSER;WASM;IsBrowser;IsWasm</DefineConstants>
32+
<PropertyGroup>
33+
<_OSArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</_OSArchitecture>
5134
</PropertyGroup>
5235

53-
<PropertyGroup Condition="$([System.String]::Copy($(RuntimeIdentifier)).Contains('x64')) OR $([System.String]::Copy($(RuntimeIdentifier)).Contains('win-x64'))">
36+
<PropertyGroup Condition="'$(_OSArchitecture)' == 'X64'">
5437
<IsX64>true</IsX64>
5538
<DefineConstants>$(DefineConstants);X64;IsX64</DefineConstants>
5639
</PropertyGroup>
5740

58-
<PropertyGroup Condition="$([System.String]::Copy($(RuntimeIdentifier)).Contains('x86')) OR $([System.String]::Copy($(RuntimeIdentifier)).Contains('win-x86'))">
41+
<PropertyGroup Condition="'$(_OSArchitecture)' == 'X86'">
5942
<IsX86>true</IsX86>
6043
<DefineConstants>$(DefineConstants);X86;IsX86</DefineConstants>
6144
</PropertyGroup>
6245

63-
<PropertyGroup Condition="$([System.String]::Copy($(RuntimeIdentifier)).Contains('arm64'))">
46+
<PropertyGroup Condition="'$(_OSArchitecture)' == 'Arm64'">
6447
<IsARM64>true</IsARM64>
6548
<DefineConstants>$(DefineConstants);ARM64;IsARM64</DefineConstants>
6649
</PropertyGroup>
6750

68-
<PropertyGroup Condition="$([System.String]::Copy($(RuntimeIdentifier)).Contains('arm')) AND !$([System.String]::Copy($(RuntimeIdentifier)).Contains('arm64'))">
51+
<PropertyGroup Condition="'$(_OSArchitecture)' == 'Arm'">
6952
<IsARM>true</IsARM>
7053
<DefineConstants>$(DefineConstants);ARM;IsARM</DefineConstants>
7154
</PropertyGroup>
7255

73-
<PropertyGroup Condition="$([System.String]::Copy($(RuntimeIdentifier)).StartsWith('ios')) OR $([System.String]::Copy($(RuntimeIdentifier)).StartsWith('android'))">
74-
<IsMobile>true</IsMobile>
75-
<DefineConstants>$(DefineConstants);MOBILE;IsMobile</DefineConstants>
76-
</PropertyGroup>
77-
78-
<PropertyGroup Condition="$([System.String]::Copy($(RuntimeIdentifier)).StartsWith('win')) OR $([System.String]::Copy($(RuntimeIdentifier)).StartsWith('linux')) OR $([System.String]::Copy($(RuntimeIdentifier)).StartsWith('osx'))">
56+
<PropertyGroup Condition="'$(IsWindows)' == 'true' OR '$(IsLinux)' == 'true' OR '$(IsOSX)' == 'true'">
7957
<IsDesktop>true</IsDesktop>
8058
<DefineConstants>$(DefineConstants);DESKTOP;IsDesktop</DefineConstants>
8159
</PropertyGroup>
8260

83-
<PropertyGroup Condition="$([System.String]::Copy($(RuntimeIdentifier)).StartsWith('linux')) OR $([System.String]::Copy($(RuntimeIdentifier)).StartsWith('osx'))">
61+
<PropertyGroup Condition="'$(IsLinux)' == 'true' OR '$(IsOSX)' == 'true'">
8462
<IsUnix>true</IsUnix>
8563
<DefineConstants>$(DefineConstants);UNIX;IsUnix</DefineConstants>
8664
</PropertyGroup>

src/Build.Watchdog.targets

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@
3434
BeforeTargets="BeforeResolveReferences"
3535
Inputs="$(WatchdogProject)"
3636
Outputs="$(WatchdogExecutable)">
37-
3837
<Message Text="Watchdog executable is out-of-date. Building..." Importance="high"/>
3938

4039
<MSBuild Projects="$(WatchdogProject)"
4140
Targets="Publish"
42-
Properties="PublishDir=$(WatchdogOutDir);" />
41+
Properties="PublishDir=$(WatchdogOutDir);TargetFramework=$(TargetFrameworkPrefix)" />
4342
</Target>
4443
</Project>

src/Everywhere.Watchdog/Everywhere.Watchdog.csproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,23 @@
55
<PublishAot>true</PublishAot>
66
<SelfContained>true</SelfContained>
77
<OptimizationPreference>Size</OptimizationPreference>
8+
<RuntimeIdentifiers>win-x64;osx-x64;osx-arm64</RuntimeIdentifiers>
9+
<RuntimeIdentifier Condition="'$(IsWindows)' == 'true' AND '$(IsX64)' == 'true'">win-x64</RuntimeIdentifier>
10+
<RuntimeIdentifier Condition="'$(IsOSX)' == 'true' AND '$(IsX64)' == 'true'">osx-x64</RuntimeIdentifier>
11+
<RuntimeIdentifier Condition="'$(IsOSX)' == 'true' AND '$(IsARM64)' == 'true'">osx-arm64</RuntimeIdentifier>
812
</PropertyGroup>
913

1014
<ItemGroup>
1115
<ProjectReference Include="..\Everywhere.Abstractions\Everywhere.Abstractions.csproj"/>
1216
</ItemGroup>
1317

18+
<Target Name="Debug" AfterTargets="Build">
19+
<Message Text="Debug: $(RuntimeIdentifier)" Importance="high"/>
20+
<Message Text="IsWindows: $(IsWindows)" Importance="high"/>
21+
<Message Text="IsOSX: $(IsOSX)" Importance="high"/>
22+
<Message Text="IsLinux: $(IsLinux)" Importance="high"/>
23+
<Message Text="IsX64: $(IsX64)" Importance="high"/>
24+
<Message Text="IsARM64: $(IsARM64)" Importance="high"/>
25+
</Target>
26+
1427
</Project>

0 commit comments

Comments
 (0)