Fixes #1741. Use gitversion instead of minver (#1746)

This commit is contained in:
Tig Kindel
2022-05-26 16:36:50 -07:00
committed by GitHub
parent cc04bb37f5
commit a95e06c15d
13 changed files with 162 additions and 166 deletions

View File

@@ -22,8 +22,8 @@ jobs:
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Build Debug
run: dotnet build --configuration Debug --no-restore
- name: Test
run: |

View File

@@ -1,4 +1,4 @@
name: Publish Terminal.Gui to nuget
name: Publish Terminal.Gui
on:
push:
tags:
@@ -7,89 +7,72 @@ on:
jobs:
publish:
name: build, pack & publish
name: Build and Publish to Nuget.org
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/checkout@v3
with:
fetch-depth: 0 #fetch-depth is needed for GitVersion
- name: Setup dotnet
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.100
- name: Install and calculate the new version with GitVersion
uses: gittools/actions/gitversion/setup@v0.9.13
with:
versionSpec: 5.x
- name: minver-cli
run: |
dotnet tool install --global minver-cli --version 2.4.0
echo "MINVERVERSIONOVERRIDE=$(minver -t v -d rc)" >> $GITHUB_ENV
- name: Determine Version
uses: gittools/actions/gitversion/execute@v0.9.13
id: gitversion # step id used as reference for output values
#- name: Install dependencies
# run: dotnet restore
- name: Display GitVersion outputs
run: |
echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
#- name: Build
# run: dotnet build --configuration Release --no-restore
- name: Setup dotnet
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.100
#- name: Pack nuget package with symbols
# run: dotnet pack --include-symbols
- name: Publish Terminal.Gui
id: publish_nuget
uses: rohith/publish-nuget@v2
with:
VERSION_STATIC: ${{ env.MINVERVERSIONOVERRIDE }}
NUGET_SOURCE: https://api.nuget.org
- name: Install dependencies
run: dotnet restore
# Filepath of the project to be packaged, relative to root of repository
PROJECT_FILE_PATH: Terminal.Gui/Terminal.Gui.csproj
# NuGet package id, used for version detection & defaults to project name
PACKAGE_NAME: Terminal.Gui
# Filepath with version info, relative to root of repository & defaults to PROJECT_FILE_PATH
#VERSION_FILE_PATH: Terminal.Gui/Directory.Build.props
- name: Build Release
run: |
dotnet-gitversion /updateprojectfiles
dotnet build --no-restore -c Release
# Regex pattern to extract version info in a capturing group
#VERSION_REGEX: ^\s*<Version>(.*)<\/Version>\s*$
# Useful with external providers like Nerdbank.GitVersioning, ignores VERSION_FILE_PATH & VERSION_REGEX
# VERSION_STATIC: 1.0.0
- name: Pack
run: dotnet pack -c Release -p:Version='${{ steps.gitversion.outputs.SemVer }}' -v d
# Flag to toggle git tagging, enabled by default
TAG_COMMIT: false
- name: Test to generate Code Coverage Report
run: |
dotnet test --verbosity normal --collect:"XPlat Code Coverage" --settings UnitTests/coverlet.runsettings
mv -v UnitTests/TestResults/*/*.* UnitTests/TestResults/
# Format of the git tag, [*] gets replaced with actual version
# TAG_FORMAT: v*
- name: Create Test Coverage Badge
uses: simon-k/dotnet-code-coverage-badge@v1.0.0
id: create_coverage_badge
with:
label: Unit Test Coverage
color: brightgreen
path: UnitTests/TestResults/coverage.opencover.xml
gist-filename: code-coverage.json
# https://gist.github.com/migueldeicaza/90ef67a684cb71db1817921a970f8d27
gist-id: 90ef67a684cb71db1817921a970f8d27
gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }}
# API key to authenticate with NuGet server
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
- name: Print Code Coverage
run: |
echo "Code coverage percentage: ${{steps.create_coverage_badge.outputs.percentage}}%"
echo "Badge data: ${{steps.create_coverage_badge.outputs.badge}}"
# NuGet server uri hosting the packages, defaults to https://api.nuget.org
# NUGET_SOURCE: https://api.nuget.org
#- name: Prep GitHub Packages
# run: dotnet nuget add source --username tig --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/tig/index.json"
# Flag to toggle pushing symbols along with nuget package to the server, disabled by default
# This is broken - see https://github.com/brandedoutcast/publish-nuget/issues/30
INCLUDE_SYMBOLS: false
#- name: Publish to GitHub packages
# run: dotnet nuget push NStack/bin/Release/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github"
- name: Test to generate Code Coverage Report
run: |
dotnet test --verbosity normal --collect:"XPlat Code Coverage" --settings UnitTests/coverlet.runsettings
mv -v UnitTests/TestResults/*/*.* UnitTests/TestResults/
- name: Create Test Coverage Badge
uses: simon-k/dotnet-code-coverage-badge@v1.0.0
id: create_coverage_badge
with:
label: Unit Test Coverage
color: brightgreen
path: UnitTests/TestResults/coverage.opencover.xml
gist-filename: code-coverage.json
# https://gist.github.com/migueldeicaza/90ef67a684cb71db1817921a970f8d27
gist-id: 90ef67a684cb71db1817921a970f8d27
gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }}
- name: Print Code Coverage
run: |
echo "Code coverage percentage: ${{steps.create_coverage_badge.outputs.percentage}}%"
echo "Badge data: ${{steps.create_coverage_badge.outputs.badge}}"
- name: Publish to NuGet.org
run: dotnet nuget push Terminal.Gui/bin/Release/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json

View File

@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<AssemblyVersion>1.6.1.0</AssemblyVersion>
<FileVersion>1.6.1.0</FileVersion>
<InformationalVersion>1.6.1+Branch.fixes-1741-gitversion.Sha.cc04bb37f5c7684d45833dabd3f7e1ca9c53786f</InformationalVersion>
<Version>1.6.1</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NStack.Core" Version="0.17.0" />
<PackageReference Include="NStack.Core" Version="0.17.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Terminal.Gui\Terminal.Gui.csproj" />
</ItemGroup>
</Project>
</Project>

View File

@@ -1,20 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<AssemblyVersion>1.6.1.0</AssemblyVersion>
<FileVersion>1.6.1.0</FileVersion>
<InformationalVersion>1.6.1+Branch.fixes-1741-gitversion.Sha.cc04bb37f5c7684d45833dabd3f7e1ca9c53786f</InformationalVersion>
<Version>1.6.1</Version>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Terminal.Gui\Terminal.Gui.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="6.0.0" />
</ItemGroup>
</Project>
</Project>

View File

@@ -1,14 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ReactiveUI.Fody" Version="18.0.10" />
<PackageReference Include="ReactiveUI" Version="18.0.10" />
<PackageReference Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="1.1.4" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Terminal.Gui\Terminal.Gui.csproj" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<AssemblyVersion>1.6.1.0</AssemblyVersion>
<FileVersion>1.6.1.0</FileVersion>
<InformationalVersion>1.6.1+Branch.fixes-1741-gitversion.Sha.cc04bb37f5c7684d45833dabd3f7e1ca9c53786f</InformationalVersion>
<Version>1.6.1</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ReactiveUI.Fody" Version="18.0.10" />
<PackageReference Include="ReactiveUI" Version="18.0.10" />
<PackageReference Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="1.1.4" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Terminal.Gui\Terminal.Gui.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,12 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<LangVersion>latest</LangVersion>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<AssemblyVersion>1.6.1.0</AssemblyVersion>
<FileVersion>1.6.1.0</FileVersion>
<InformationalVersion>1.6.1+Branch.fixes-1741-gitversion.Sha.cc04bb37f5c7684d45833dabd3f7e1ca9c53786f</InformationalVersion>
<Version>1.6.1</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Terminal.Gui" Version="1.4.0" />
</ItemGroup>
</Project>
</Project>

View File

@@ -1,6 +1,6 @@
# Terminal.Gui Project
Contains all files required to build the **Terminal.Gui** library (and NuGEt package).
Contains all files required to build the **Terminal.Gui** library (and NuGet package).
## Project Folder Structure
@@ -22,33 +22,40 @@ Contains all files required to build the **Terminal.Gui** library (and NuGEt pac
## Version numbers
Version info for Terminal.Gui is managed by MinVer (https://github.com/adamralph/minver).
Version info for Terminal.Gui is managed by [gitversion](https://gitversion.net).
The project version (the nuget package and in `Terminal.Gui.dlls`) is determined from the latest `git tag`.
Install `gitversion`:
```powershell
dotnet tool install --global GitVersion.Tool
dotnet-gitversion
```
The project version (the nuget package and in `Terminal.Gui.dll`) is determined from the latest `git tag`.
The format of version numbers is `vmajor.minor.patch.build.height` and follows the [Semantic Versioning](https://semver.org/) rules.
To define a new version (e.g. with a higher `major`, `minor`, `patch`, or `build` value) tag a commit using `git tag`:
```powershell
git tag v1.3.4-beta.5 -a -m "v1.3.4 Beta 5"
git tag v1.3.4-beta.5 -a -m "Release v1.3.4 Beta 5"
dotnet-gitversion /updateprojectfiles
dotnet build -c Release
```
If the current commit does not have a version tag, another number is added to the pre-release identifiers. This is the number of commits since the latest commit with a version tag or, if no commits have a version tag, since the root commit. This is known as "height". For example, if the latest version tag found is 1.0.0-beta.1, at a height of 42 commits, the calculated version is 1.0.0-beta.1.42.
You can see the version in the `UICatalog` about box or by viewing the "Details" page of the file properties of `/Terminal.Gui/bin/Release/net5.0/Terminal.Gui.dll.
You can see the version in the `UICatalog` about box.
![About Box](https://raw.githubusercontent.com/migueldeicaza/gui.cs/master/docfx/aboutbox.png)
## Publishing a Release of Terminal.Gui
To release a new version (e.g. with a higher `major`, `minor`, or `patch` value) tag a commit using `git tag` and then push that tag directly to the upstream repo:
To release a new version (e.g. with a higher `major`, `minor`, or `patch` value) tag a commit using `git tag` and then push that tag directly to the upstream repo.
The `tag` must be of the form `v<major>.<minor>.<patch>`, e.g. `v1.2.3`.
```powershell
git tag vmajor.minor.patch.build -a -m "Descriptive comment about release"
git push upstream vmajor.minor.patch.build
git tag vmajor.minor.patch -a -m "Release vmajor.minor.patch"
git push upstream vmajor.minor.patch
```
`patch` can indicate pre-release or not (e.g. `pre`, `beta`, `rc`, etc...).
@@ -62,49 +69,63 @@ git push upstream v1.3.4-beta.5
## To launch version 2.3.4 as a Release nuget package do this:
1) Create a new tag
1) Generate release notes with the list of PRs since the last release
Use `gh` to get list with just titles to make it easy to paste into release notes:
```powershell
git tag v2.3.4 -a -m "v2.3.4 Release"
```
gh pr list --limit 500 --search "is:pr is:closed is:merged closed:>=2021-05-18"
```
2) Update `./Terminal.Gui/Terminal.Gui.csproj` with latest release notes and submit a PR with a commit of `v2.3.4 Release`
Use the output to update `./Terminal.Gui/Terminal.Gui.csproj` with latest release notes
* Use `gh` to get list with just titles to make it easy to paste into release notes: `gh pr list --limit 500 --search "is:pr is:closed is:merged closed:>=2021-05-18"`
* PR title should be "v2.3.4 Release"
2) Update the API documentation
See `./docfx/README.md`.
3) Create a PR for the release
The PR title should be "Release v2.3.4"
```powershell
git add .
git commit -m "v2.3.4 Release"
git commit -m "Release v2.3.4"
git push
```
3) Pull upstream after PR has been merged
4) On github.co, verify the build action worked on your fork, then merge the PR
5) Pull the merged main
```powershell
git pull upstream main
```
4) Push new tag to `main`
6) Create a new tag for the release
```powershell
git tag v2.3.4 -a -m "Release v2.3.4"
```
7) Push new tag to `main`
```powershell
git tag v2.3.4 -a -m "v2.3.4 Release"
git push upstream v2.3.4
```
5) Monitor Github actions to ensure it worked.
8) Monitor Github actions to ensure it worked.
6) Check nuget to see new package (wait a few minutes)
9) Check nuget to see new package (wait a few minutes)
https://www.nuget.org/packages/Terminal.Gui
7) Add a new Release in Github: https://github.com/migueldeicaza/gui.cs/releases
10) Add a new Release in Github: https://github.com/migueldeicaza/gui.cs/releases
## Nuget
https://www.nuget.org/packages/Terminal.Gui
When a new version tag is defined, and merged into master, a nuget package will be generated.
When a new version tag is defined, and merged into main, a nuget package will be generated.
If the version is pre-release (includes a hyphen, e.g. `1.3.4-beta.5`) the Nuget package will be tagged as pre-release.

View File

@@ -2,24 +2,24 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType></DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineConstants>TRACE;DEBUG_IDISPOSABLE</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<!-- Uncomment this to have dotnet restore pull NStack from a local dir for testing -->
<!-- See https://stackoverflow.com/a/44463578/297526 -->
<!-- Version numbers are automatically updated by gitversion. Do not modify here. -->
<AssemblyVersion>1.6.1.0</AssemblyVersion>
<FileVersion>1.6.1.0</FileVersion>
<InformationalVersion>1.6.1+Branch.fixes-1741-gitversion.Sha.cc04bb37f5c7684d45833dabd3f7e1ca9c53786f</InformationalVersion>
<Version>1.6.1</Version>
<!-- Uncomment this to have dotnet restore pull NStack from a local dir for testing -->
<!-- See https://stackoverflow.com/a/44463578/297526 -->
<!--<RestoreSources>$(RestoreSources);../../local-packages;https://api.nuget.org/v3/index.json</RestoreSources>-->
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all" />
<PackageReference Include="NStack.Core" Version="0.17.0" />
<PackageReference Include="MinVer" Version="4.0.0" PrivateAssets="all" />
<PackageReference Include="NStack.Core" Version="0.17.1" />
<InternalsVisibleTo Include="UnitTests" />
</ItemGroup>
<ItemGroup>
<Compile Update="Resources\Strings.Designer.cs">
<DesignTime>True</DesignTime>
@@ -27,7 +27,6 @@
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Strings.resx">
<Generator>ResXFileCodeGenerator</Generator>
@@ -35,12 +34,6 @@
</EmbeddedResource>
</ItemGroup>
<PropertyGroup>
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
<!-- See Terminal.Gui/README.md for how version numbering works -->
<!-- This enables prefixing version tags with v, e.g. v1.0.0 Instead of 1.0.0 -->
<MinVerTagPrefix>v</MinVerTagPrefix>
<TargetFrameworks>net472;netstandard2.0;net6.0</TargetFrameworks>
<RootNamespace>Terminal.Gui</RootNamespace>
<AssemblyName>Terminal.Gui</AssemblyName>
@@ -57,7 +50,6 @@
<Owners>Miguel de Icaza</Owners>
<Summary>Application framework for creating modern console applications using .NET</Summary>
<Title>Terminal.Gui is a framework for creating console user interfaces</Title>
<PackageReleaseNotes>
v1.6.0
* Adds ColorPicker control
@@ -435,4 +427,4 @@
* Fixes #838. Added a Visible property to the View. (Thanks @bidsp!)
</PackageReleaseNotes>
</PropertyGroup>
</Project>
</Project>

View File

@@ -14,8 +14,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveExample", "Reactive
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E143FB1F-0B88-48CB-9086-72CDCECFCD22}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md
CONTRIBUTING.md = CONTRIBUTING.md
.github\workflows\dotnet-core.yml = .github\workflows\dotnet-core.yml
.github\workflows\publish.yml = .github\workflows\publish.yml
README.md = README.md
EndProjectSection

View File

@@ -1,8 +1,7 @@
{
"profiles": {
"UICatalog": {
"commandName": "Project",
"commandLineArgs": "\"ProgressBar Styles\""
"commandName": "Project"
},
"UICatalog : -usc": {
"commandName": "Project",

View File

@@ -166,7 +166,7 @@ namespace UICatalog {
aboutMessage.AppendLine (@" | | __/ | | | | | | | | | | | (_| | || |__| | |_| | |");
aboutMessage.AppendLine (@" |_|\___|_| |_| |_| |_|_|_| |_|\__,_|_(_)_____|\__,_|_|");
aboutMessage.AppendLine (@"");
aboutMessage.AppendLine ($"Using Terminal.Gui Version: {FileVersionInfo.GetVersionInfo (typeof (Terminal.Gui.Application).Assembly.Location).ProductVersion}");
aboutMessage.AppendLine ($"Using Terminal.Gui Version: {FileVersionInfo.GetVersionInfo (typeof (Terminal.Gui.Application).Assembly.Location).FileVersion}");
aboutMessage.AppendLine (@"");
_menu = new MenuBar (new MenuBarItem [] {

View File

@@ -1,23 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<StartupObject>UICatalog.UICatalogApp</StartupObject>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<AssemblyVersion>1.6.1.0</AssemblyVersion>
<LangVersion>8.0</LangVersion>
<FileVersion>1.6.1.0</FileVersion>
<InformationalVersion>1.6.1+Branch.fixes-1741-gitversion.Sha.cc04bb37f5c7684d45833dabd3f7e1ca9c53786f</InformationalVersion>
<Version>1.6.1</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG_IDISPOSABLE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Terminal.Gui\Terminal.Gui.csproj" />
</ItemGroup>
</Project>
</Project>

View File

@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<UseDataCollector />
<AssemblyVersion>1.6.1.0</AssemblyVersion>
<FileVersion>1.6.1.0</FileVersion>
<InformationalVersion>1.6.1+Branch.fixes-1741-gitversion.Sha.cc04bb37f5c7684d45833dabd3f7e1ca9c53786f</InformationalVersion>
<Version>1.6.1</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG_IDISPOSABLE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="ReportGenerator" Version="5.1.9" />
@@ -28,12 +28,10 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Terminal.Gui\Terminal.Gui.csproj" />
<ProjectReference Include="..\UICatalog\UICatalog.csproj" />
</ItemGroup>
<PropertyGroup Label="FineCodeCoverage">
<Enabled>
True
@@ -41,8 +39,7 @@
<Exclude>
[UICatalog]*
</Exclude>
<Include>
</Include>
<Include></Include>
<ExcludeByFile>
<!--**/Migrations/*
**/Hacks/*.cs-->
@@ -54,5 +51,4 @@
False
</IncludeTestAssembly>
</PropertyGroup>
</Project>
</Project>