Skip to content

Commit 70a5768

Browse files
authored
Merge pull request #99 from webwarrior-ws/fix-linux-maui-94
Build nuget packages in CI and push to nuget.org
2 parents 0c1dbde + b747cd8 commit 70a5768

34 files changed

+107
-57
lines changed

.github/workflows/build-gtk.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,21 @@ jobs:
3131
chmod 764 $WORKLOAD_MANIFEST_DIR/*
3232
dotnet workload search
3333
dotnet workload install gtk --skip-manifest-update
34+
- name: Generate pre-release version suffix
35+
run: dotnet fsi nugetPreRelease.fsx "" > PreReleaseVersionSuffix.txt
3436
- name: Build MAUI
3537
run: |
3638
sed -i 's/_IncludeAndroid>true/_IncludeAndroid>/g' Directory.Build.Override.props
3739
dotnet build Microsoft.Maui.BuildTasks.slnf
38-
dotnet build Microsoft.Maui.Gtk.slnf
40+
dotnet build -c Release Microsoft.Maui.Gtk.slnf
41+
- name: Pack MAUI
42+
run: dotnet pack Microsoft.Maui.Gtk.Packages.slnf
43+
- name: Upload binaries to nuget (if tag or main branch, and nugetKey is present)
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
NUGET_KEY: ${{ secrets.NUGET_KEY }}
47+
if: ${{ env.NUGET_KEY != '' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
48+
run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
3949

4050
dotnet-format:
4151
needs: build_and_test

Microsoft.Maui.Gtk.Packages.slnf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"solution": {
3+
"path": "Microsoft.Maui.sln",
4+
"projects": [
5+
"src\\BlazorWebView\\src\\Gtk\\Microsoft.AspNetCore.Components.WebView.Gtk.csproj",
6+
"src\\BlazorWebView\\src\\Maui\\Microsoft.AspNetCore.Components.WebView.Maui.csproj",
7+
"src\\Compatibility\\Core\\src\\Compatibility.csproj",
8+
"src\\Controls\\src\\Build.Tasks\\Controls.Build.Tasks.csproj",
9+
"src\\Controls\\src\\Core\\Controls.Core.csproj",
10+
"src\\Controls\\src\\Xaml\\Controls.Xaml.csproj",
11+
"src\\Core\\src\\Core.csproj",
12+
"src\\Essentials\\src\\Essentials.csproj",
13+
"src\\Graphics\\src\\Graphics.Gtk\\Graphics.Gtk.csproj",
14+
"src\\Graphics\\src\\Graphics.Skia.GtkSharp\\Graphics.Skia.GtkSharp.csproj",
15+
"src\\Graphics\\src\\Graphics.Skia\\Graphics.Skia.csproj",
16+
"src\\Graphics\\src\\Graphics\\Graphics.csproj",
17+
"src\\Graphics\\src\\Text.Markdig\\Graphics.Text.Markdig.csproj",
18+
"src\\SingleProject\\Resizetizer\\src\\Resizetizer.csproj"
19+
]
20+
}
21+
}

eng/Versions.targets

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
</Target>
4949
<Target Name="SetVersions" BeforeTargets="$(SetVersionsBefore)" DependsOnTargets="$(SetVersionsDependsOn)" Returns="$(Version)">
5050
<PropertyGroup>
51+
<GitTag Condition="$(GITHUB_REF_TYPE) == 'tag'">$(GITHUB_REF_NAME)</GitTag>
5152
<SemVerLabel>$([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(RegexTag)))</SemVerLabel>
5253
<GitDefaultBranch>main</GitDefaultBranch>
5354
<GitIgnoreBranchVersion>true</GitIgnoreBranchVersion>
@@ -64,13 +65,17 @@
6465

6566
<VersionMetadata Condition="'$(GitCommit)' != ''" Include="sha.$(GitCommit)"/>
6667

67-
<VersionMetadata Condition="$(CI)"
68+
<VersionMetadata Condition="$(CI) and '$(BUILD_BUILDID)' != ''"
6869
Include="azdo.$(BUILD_BUILDID)"/>
6970
</ItemGroup>
7071

72+
<Error Text="Git tag ($(GitTag)) != version extracted from GitInfo.txt ($(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch))"
73+
Condition="'$(GitTag)' != '' and '$(GitTag)' != '$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)'">
74+
</Error>
75+
7176
<PropertyGroup>
7277
<VersionMetadataLabel>@(VersionMetadata -> '%(Identity)', '-')</VersionMetadataLabel>
73-
<VersionMetadataPlusLabel Condition="'$(VersionMetadataLabel)' != ''">+$(VersionMetadataLabel)</VersionMetadataPlusLabel>
78+
<VersionMetadataPlusLabel Condition="'$(VersionMetadataLabel)' != ''">0+$(VersionMetadataLabel)</VersionMetadataPlusLabel>
7479
<Version>$(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)</Version>
7580
<PackageReferenceVersion>$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(GitSemVerDashLabel)</PackageReferenceVersion>
7681
<PackageReferenceVersion Condition="$(CI) and '$(GitSemVerDashLabel)' != ''">$(GitSemVerMajor).$(GitSemVerMinor).$(GitBaseVersionPatch)$(GitSemVerDashLabel).$(BUILDVERSION)</PackageReferenceVersion>
@@ -79,6 +84,11 @@
7984
<VSComponentVersion Condition="$(CI) and '$(GitSemVerDashLabel)' != ''">$(GitSemVerMajor).$(GitSemVerMinor).$(GitBaseVersionPatch).$(BUILDVERSION)</VSComponentVersion>
8085
<VSComponentVersion Condition="$(CI) and '$(GitSemVerDashLabel)' == ''">$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch).0</VSComponentVersion>
8186
<PackageVersion>$(PackageReferenceVersion)$(VersionMetadataPlusLabel)</PackageVersion>
87+
<!-- Generate stable release package for tags -->
88+
<PackageVersion Condition=" '$(GitTag)' != '' ">$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)</PackageVersion>
89+
<!-- Pre-release version for other cases -->
90+
<PreReleaseVersionSuffix>$([System.IO.File]::ReadAllText($(MSBuildThisFileDirectory)../PreReleaseVersionSuffix.txt))</PreReleaseVersionSuffix>
91+
<PackageVersion Condition="$(CI) and '$(GitTag)' == '' ">$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(PreReleaseVersionSuffix)</PackageVersion>
8292
</PropertyGroup>
8393

8494
<PropertyGroup>

nugetPreRelease.fsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#r "nuget: Fsdk, Version=0.6.0"
2+
3+
let args = fsi.CommandLineArgs
4+
5+
Fsdk.Network.GetNugetPrereleaseVersionFromBaseVersion args.[1]
6+
|> System.Console.WriteLine

src/BlazorWebView/samples/BlazorGtkApp/BlazorGtkApp.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

3-
<Import Project="..\..\src\Gtk\build\Microsoft.AspNetCore.Components.WebView.Gtk.props"/>
3+
<Import Project="..\..\src\Gtk\build\GtkSharp.Maui.AspNetCore.Components.WebView.Gtk.props"/>
44

55
<PropertyGroup>
66
<TargetFrameworks>$(_MauiDotNetTfm)-gtk</TargetFrameworks>
@@ -14,7 +14,7 @@
1414
<ProjectReference Include="..\WebViewAppShared\WebViewAppShared.csproj"/>
1515
</ItemGroup>
1616

17-
<Import Project="..\..\src\Gtk\build\Microsoft.AspNetCore.Components.WebView.Gtk.targets"/>
17+
<Import Project="..\..\src\Gtk\build\GtkSharp.Maui.AspNetCore.Components.WebView.Gtk.targets"/>
1818

1919
<ItemGroup>
2020
<PackageReference Include="Microsoft.Extensions.Logging.Console"/>

src/BlazorWebView/src/Gtk/Microsoft.AspNetCore.Components.WebView.Gtk.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TargetFrameworks>$(_MauiDotNetTfm)-gtk</TargetFrameworks>
55
<SupportedOSPlatformVersion>3.24</SupportedOSPlatformVersion>
66
<Description>Build Gtk applications with Blazor and WebKit</Description>
7+
<PackageId>GtkSharp.Maui.AspNetCore.Components.WebView.Gtk</PackageId>
78
<DefineConstants>$(DefineConstants);WEBKIT_GTK</DefineConstants>
89
<Nullable>enable</Nullable>
910
<GenerateDocumentationFile>true</GenerateDocumentationFile>

src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
<PropertyGroup>
1111
<!-- NuGet package information -->
1212
<IsPackable>true</IsPackable>
13-
<PackageId>Microsoft.AspNetCore.Components.WebView.Maui</PackageId>
13+
<PackageId>GtkSharp.Maui.AspNetCore.Components.WebView</PackageId>
1414
<PackageTags>$(DefaultPackageTags);blazor;webview;aspnet</PackageTags>
1515
<PackageIconFile>$(MauiRootDirectory)Assets\aspnet-icon.png</PackageIconFile>
16-
<Description>Build .NET Multi-platform App UI (.NET MAUI) apps with Blazor web UI in the BlazorWebView control.</Description>
16+
<Description>(MauiLinux is a fork of MAUI) Build .NET Multi-platform App UI (.NET MAUI) apps with Blazor web UI in the BlazorWebView control.</Description>
1717
</PropertyGroup>
1818

1919
<Import Project="$(MauiSrcDirectory)MultiTargeting.targets" />
@@ -40,7 +40,7 @@
4040
</ItemGroup>
4141

4242
<ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'gtk' ">
43-
<Compile Include="..\Gtk.SharedSource\**\*.cs" Link="Gtk\SharedSource\%(Filename)%(Extension)"/>
43+
<Compile Include="..\Gtk.SharedSource\**\*.cs" Link="Gtk\SharedSource\%(Filename)%(Extension)" />
4444
</ItemGroup>
4545

4646

0 commit comments

Comments
 (0)