Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build nuget packages in CI and push to nuget.org #34

Merged
merged 6 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions .github/workflows/build-gtk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,21 @@ jobs:
chmod 764 $WORKLOAD_MANIFEST_DIR/*
dotnet workload search
dotnet workload install gtk --skip-manifest-update
- name: Generate pre-release version suffix
run: dotnet fsi nugetPreRelease.fsx "" > PreReleaseVersionSuffix.txt
- name: Build MAUI
run: |
sed -i 's/_IncludeAndroid>true/_IncludeAndroid>/g' Directory.Build.Override.props
mv Directory.Build.Override.props.in Directory.Build.Override.props
dotnet build Microsoft.Maui.BuildTasks.slnf
dotnet build Microsoft.Maui.Gtk.slnf
- name: Build ZXing.Net.Maui
run: |
dotnet build ./src/ZXing.Net.Maui/ZXing.Net.MAUI/ZXing.Net.MAUI.csproj --framework=net8.0-gtk
dotnet build ./src/ZXing.Net.Maui/ZXing.Net.MAUI.Controls/ZXing.Net.MAUI.Controls.csproj --framework=net8.0-gtk
dotnet build -c Release Mali.slnf
- name: Pack MAUI
run: dotnet pack Mali.slnf --no-build --no-restore
- name: Upload binaries to nuget (if tag or main branch, and nugetKey is present)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUGET_KEY: ${{ secrets.NUGET_KEY }}
if: ${{ env.NUGET_KEY != '' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

dotnet-format:
needs: build_and_test
Expand Down
15 changes: 15 additions & 0 deletions Mali.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"solution": {
"path": "Microsoft.Maui.sln",
"projects": [
"src\\BlazorWebView\\src\\Maui\\Microsoft.AspNetCore.Components.WebView.Maui.csproj",
"src\\Essentials\\src\\Essentials.csproj",
"src\\Controls\\src\\Core\\Controls.Core.csproj",
"src\\Controls\\src\\Xaml\\Controls.Xaml.csproj",
"src\\Core\\src\\Core.csproj",
"src\\Compatibility\\Core\\src\\Compatibility.csproj",
"src\\Controls\\Foldable\\src\\Controls.Foldable.csproj",
"src\\Graphics\\src\\Graphics\\Graphics.csproj"
]
}
}
3 changes: 3 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
<SystemNumericsVectorsVersion>4.5.0</SystemNumericsVectorsVersion>
<SystemMemoryPackageVersion>4.5.5</SystemMemoryPackageVersion>
<SystemBuffersPackageVersion>4.5.1</SystemBuffersPackageVersion>
<SystemTextJsonPackageVersion>8.0.5</SystemTextJsonPackageVersion>
<SystemTextEncodingsWebPackageVersion>8.0.0</SystemTextEncodingsWebPackageVersion>
<MicrosoftBclAsyncInterfacesPackageVersion>8.0.0</MicrosoftBclAsyncInterfacesPackageVersion>
<SystemIOUnmanagedMemoryStreamPackageVersion>4.3.0</SystemIOUnmanagedMemoryStreamPackageVersion>
<SystemObjectModelPackageVersion>4.3.0</SystemObjectModelPackageVersion>
<SystemRuntimeCompilerServicesUnsafePackageVersion>6.0.0</SystemRuntimeCompilerServicesUnsafePackageVersion>
Expand Down
14 changes: 12 additions & 2 deletions eng/Versions.targets
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
</Target>
<Target Name="SetVersions" BeforeTargets="$(SetVersionsBefore)" DependsOnTargets="$(SetVersionsDependsOn)" Returns="$(Version)">
<PropertyGroup>
<GitTag Condition="$(GITHUB_REF_TYPE) == 'tag'">$(GITHUB_REF_NAME)</GitTag>
<SemVerLabel>$([System.Text.RegularExpressions.Regex]::Match($(GitTag), $(RegexTag)))</SemVerLabel>
<GitDefaultBranch>main</GitDefaultBranch>
<GitIgnoreBranchVersion>true</GitIgnoreBranchVersion>
Expand All @@ -64,13 +65,17 @@

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

<VersionMetadata Condition="$(CI)"
<VersionMetadata Condition="$(CI) and '$(BUILD_BUILDID)' != ''"
Include="azdo.$(BUILD_BUILDID)"/>
</ItemGroup>

<Error Text="Git tag ($(GitTag)) != version extracted from GitInfo.txt ($(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch))"
Condition="'$(GitTag)' != '' and '$(GitTag)' != '$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)'">
</Error>

<PropertyGroup>
<VersionMetadataLabel>@(VersionMetadata -> '%(Identity)', '-')</VersionMetadataLabel>
<VersionMetadataPlusLabel Condition="'$(VersionMetadataLabel)' != ''">+$(VersionMetadataLabel)</VersionMetadataPlusLabel>
<VersionMetadataPlusLabel Condition="'$(VersionMetadataLabel)' != ''">0+$(VersionMetadataLabel)</VersionMetadataPlusLabel>
<Version>$(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)</Version>
<PackageReferenceVersion>$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(GitSemVerDashLabel)</PackageReferenceVersion>
<PackageReferenceVersion Condition="$(CI) and '$(GitSemVerDashLabel)' != ''">$(GitSemVerMajor).$(GitSemVerMinor).$(GitBaseVersionPatch)$(GitSemVerDashLabel).$(BUILDVERSION)</PackageReferenceVersion>
Expand All @@ -79,6 +84,11 @@
<VSComponentVersion Condition="$(CI) and '$(GitSemVerDashLabel)' != ''">$(GitSemVerMajor).$(GitSemVerMinor).$(GitBaseVersionPatch).$(BUILDVERSION)</VSComponentVersion>
<VSComponentVersion Condition="$(CI) and '$(GitSemVerDashLabel)' == ''">$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch).0</VSComponentVersion>
<PackageVersion>$(PackageReferenceVersion)$(VersionMetadataPlusLabel)</PackageVersion>
<!-- Generate stable release package for tags -->
<PackageVersion Condition=" '$(GitTag)' != '' ">$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)</PackageVersion>
<!-- Pre-release version for other cases -->
<PreReleaseVersionSuffix>$([System.IO.File]::ReadAllText($(MSBuildThisFileDirectory)../PreReleaseVersionSuffix.txt))</PreReleaseVersionSuffix>
<PackageVersion Condition="$(CI) and '$(GitTag)' == '' ">$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(PreReleaseVersionSuffix)</PackageVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
6 changes: 6 additions & 0 deletions nugetPreRelease.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#r "nuget: Fsdk, Version=0.6.0--date20231213-0703.git-d7a5962"

let args = fsi.CommandLineArgs

Fsdk.Network.GetNugetPrereleaseVersionFromBaseVersion args.[1]
|> System.Console.WriteLine
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PropertyGroup>
<!-- NuGet package information -->
<IsPackable>true</IsPackable>
<PackageId>Microsoft.AspNetCore.Components.WebView.Maui</PackageId>
<PackageId>Mali.AspNetCore.Components.WebView</PackageId>
<PackageTags>$(DefaultPackageTags);blazor;webview;aspnet</PackageTags>
<PackageIconFile>$(MauiRootDirectory)Assets\aspnet-icon.png</PackageIconFile>
<Description>Build .NET Multi-platform App UI (.NET MAUI) apps with Blazor web UI in the BlazorWebView control.</Description>
Expand Down
2 changes: 1 addition & 1 deletion src/Compatibility/Core/src/Compatibility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PropertyGroup>
<!-- NuGet package information -->
<IsPackable>True</IsPackable>
<PackageId>Microsoft.Maui.Controls.Compatibility</PackageId>
<PackageId>Mali.Controls.Compatibility</PackageId>
<PackageTags>$(DefaultPackageTags);compatibility;xamarin.forms;migration</PackageTags>
<Description>Compatibility APIs and objects for .NET Multi-platform App UI (.NET MAUI) apps. This package contains a collection of APIs and views that allow for easier migration from Xamarin.Forms.</Description>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Controls/Foldable/src/Controls.Foldable.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetFrameworks>$(_MauiDotNetTfm);$(MauiPlatforms)</TargetFrameworks>
<AssemblyName>Microsoft.Maui.Controls.Foldable</AssemblyName>
<RootNamespace>Microsoft.Maui.Controls.Foldable</RootNamespace>
<PackageId>Mali.Controls.Foldable</PackageId>
<WarningsNotAsErrors>BI1234</WarningsNotAsErrors>
<IsTrimmable>false</IsTrimmable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<Import Condition=" '$(UseMaui)' != 'true' " Project="..\..\..\BlazorWebView\src\Maui\build\Microsoft.AspNetCore.Components.WebView.Maui.props" />
<Import Condition=" '$(UseMaui)' != 'true' " Project="..\..\..\BlazorWebView\src\Maui\build\Mali.AspNetCore.Components.WebView.props" />

<PropertyGroup>
<TargetFrameworks>$(MauiPlatforms);$(_MauiDotNetTfm)</TargetFrameworks>
Expand Down Expand Up @@ -93,7 +93,7 @@
<Content Remove="Properties\launchSettings.json" />
</ItemGroup>

<Import Condition=" '$(UseMaui)' != 'true' " Project="..\..\..\BlazorWebView\src\Maui\build\Microsoft.AspNetCore.Components.WebView.Maui.targets" />
<Import Condition=" '$(UseMaui)' != 'true' " Project="..\..\..\BlazorWebView\src\Maui\build\Mali.AspNetCore.Components.WebView.targets" />

<Import Project="$(MauiSrcDirectory)Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />

Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/Controls.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PropertyGroup>
<!-- NuGet package information -->
<IsPackable>true</IsPackable>
<PackageId>Microsoft.Maui.Controls.Core</PackageId>
<PackageId>Mali.Controls.Core</PackageId>
<Description>.NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating native mobile and desktop apps with C# and XAML. This package only contains the core C# and XAML objects used by .NET MAUI. Please install the Microsoft.Maui.Controls package to start using .NET MAUI.</Description>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Xaml/Controls.Xaml.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PropertyGroup>
<!-- NuGet package information -->
<IsPackable>true</IsPackable>
<PackageId>Microsoft.Maui.Controls.Xaml</PackageId>
<PackageId>Mali.Controls.Xaml</PackageId>
<Description>.NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating native mobile and desktop apps with C# and XAML. This package only contains the XAML tooling. Please install the Microsoft.Maui.Controls package to start using .NET MAUI.</Description>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PropertyGroup>
<!-- NuGet package information -->
<IsPackable>true</IsPackable>
<PackageId>Microsoft.Maui.Core</PackageId>
<PackageId>Mali.Core</PackageId>
<Description>.NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating native mobile and desktop apps with C# and XAML. This package only contains the core objects used by .NET MAUI. Please install the Microsoft.Maui.Controls package to start using .NET MAUI.</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<UsingMicrosoftMauiCoreSdk>true</UsingMicrosoftMauiCoreSdk>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)Microsoft.Maui.Core.Before.targets" />
<Import Project="$(MSBuildThisFileDirectory)Mali.Core.Before.targets" />

<PropertyGroup>
<AfterMicrosoftNETSdkTargets>$(AfterMicrosoftNETSdkTargets);$(MSBuildThisFileDirectory)Microsoft.Maui.Core.After.targets</AfterMicrosoftNETSdkTargets>
<AfterMicrosoftNETSdkTargets>$(AfterMicrosoftNETSdkTargets);$(MSBuildThisFileDirectory)Mali.Core.After.targets</AfterMicrosoftNETSdkTargets>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<WinUISDKReferences Condition=" '$(WinUISDKReferences)' == '' and '$(EnableMsixTooling)' == 'true' ">false</WinUISDKReferences>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)..\Microsoft.Maui.Core.props" />
<Import Project="$(MSBuildThisFileDirectory)..\Mali.Core.props" />

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>

<Import Project="$(MSBuildThisFileDirectory)..\Mali.Core.targets" />

</Project>

This file was deleted.

2 changes: 1 addition & 1 deletion src/Essentials/src/Essentials.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PropertyGroup>
<!-- NuGet package information -->
<IsPackable>true</IsPackable>
<PackageId>Microsoft.Maui.Essentials</PackageId>
<PackageId>Mali.Essentials</PackageId>
<PackageTags>$(DefaultPackageTags);essentials;sensors</PackageTags>
<Description>.NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating native mobile and desktop apps with C# and XAML. This package contains a collection of cross-platform APIs for working with device sensors and other features.</Description>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Graphics/src/Graphics/Graphics.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PropertyGroup>
<!-- NuGet package information -->
<IsPackable>true</IsPackable>
<PackageId>Microsoft.Maui.Graphics</PackageId>
<PackageId>Mali.Graphics</PackageId>
<PackageTags>$(DefaultPackageTags);graphics;drawing</PackageTags>
<Description>.NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating native mobile and desktop apps with C# and XAML. This package contains a collection of cross-platform graphics and drawing APIs.</Description>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Maui.InTree.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<ImportGroup Condition="Exists('$(_MauiBuildTasksLocation)Microsoft.Maui.Controls.Build.Tasks.dll') and Exists('$(_MauiBuildTasksLocation)Microsoft.Maui.Resizetizer.dll')">

<!-- Microsoft.Maui.Core.props -->
<Import Project="$(_MauiBuildTasksLocation)net6.0-windows10.0.17763.0\Microsoft.Maui.Core.props" Condition="'$(_MauiTargetPlatformIsWindows)' == 'true'" />
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Core.props" Condition="'$(_MauiTargetPlatformIsWindows)' != 'true'" />
<Import Project="$(_MauiBuildTasksLocation)net6.0-windows10.0.17763.0\Mali.Core.props" Condition="'$(_MauiTargetPlatformIsWindows)' == 'true'" />
<Import Project="$(_MauiBuildTasksLocation)Mali.Core.props" Condition="'$(_MauiTargetPlatformIsWindows)' != 'true'" />

<!-- Microsoft.Maui.Controls.Build.Tasks.props -->
<Import Project="$(_MauiBuildTasksLocation)net6.0-ios10.0\Microsoft.Maui.Controls.Build.Tasks.props" Condition="'$(_MauiTargetPlatformIsiOS)' == 'true'" />
Expand Down
4 changes: 2 additions & 2 deletions src/Maui.InTree.targets
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<ImportGroup Condition="Exists('$(_MauiBuildTasksLocation)Microsoft.Maui.Controls.Build.Tasks.dll') and Exists('$(_MauiBuildTasksLocation)Microsoft.Maui.Resizetizer.dll')">

<!-- Microsoft.Maui.Core.targets -->
<Import Project="$(_MauiBuildTasksLocation)net6.0-windows10.0.17763.0\Microsoft.Maui.Core.targets" Condition="'$(_MauiTargetPlatformIsWindows)' == 'true'" />
<Import Project="$(_MauiBuildTasksLocation)Microsoft.Maui.Core.targets" Condition="'$(_MauiTargetPlatformIsWindows)' != 'true'" />
<Import Project="$(_MauiBuildTasksLocation)net6.0-windows10.0.17763.0\Mali.Core.targets" Condition="'$(_MauiTargetPlatformIsWindows)' == 'true'" />
<Import Project="$(_MauiBuildTasksLocation)Mali.Core.targets" Condition="'$(_MauiTargetPlatformIsWindows)' != 'true'" />

<!-- Microsoft.Maui.Controls.Build.Tasks.targets -->
<Import Project="$(_MauiBuildTasksLocation)net6.0-ios10.0\Microsoft.Maui.Controls.Build.Tasks.targets" Condition="'$(_MauiTargetPlatformIsiOS)' == 'true'" />
Expand Down