Skip to content

Commit

Permalink
Version.targets,GithubCI: upload pre-release pkg
Browse files Browse the repository at this point in the history
Upload pre-release package on `main` branch using
nugetPreRelease.fsx to get a version number that
includes the date and commit hash inside it.
  • Loading branch information
webwarrior-ws committed Dec 4, 2024
1 parent 7503b15 commit 2393bc0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build-gtk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,20 @@ 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
dotnet build Microsoft.Maui.BuildTasks.slnf
dotnet build -c Release Microsoft.Maui.Gtk.slnf
- name: Pack MAUI
run: dotnet pack Microsoft.Maui.Gtk.slnf
- name: Upload binaries to nuget (if tag, and nugetKey is present)
- 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 != '' && startsWith(github.ref, 'refs/tags/') }}
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:
Expand Down
3 changes: 3 additions & 0 deletions eng/Versions.targets
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@
<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"

let args = fsi.CommandLineArgs

Fsdk.Network.GetNugetPrereleaseVersionFromBaseVersion args.[1]
|> System.Console.WriteLine

0 comments on commit 2393bc0

Please sign in to comment.