Giter Site home page Giter Site logo

versionize / versionize Goto Github PK

View Code? Open in Web Editor NEW
265.0 7.0 41.0 290 KB

Automatic versioning and CHANGELOG generation, with semver and conventional commits for dotnet

License: MIT License

C# 99.53% Batchfile 0.47%
semantic-versioning semantic-release dotnet-core dotnet-cli git changelog

versionize's Introduction

Versionize

Coverage Status Conventional Commits

stop using weird build scripts to increment your nuget's version, use versionize!

Automatic versioning and CHANGELOG generation, using conventional commit messages.

how it works:

  1. when you land commits on your main branch, select the Squash and Merge option (not required).
  2. add a title and body that follows the Conventional Commits Specification.
  3. when you're ready to release a nuget package:
    1. git checkout main; git pull origin main
    2. run versionize
    3. git push --follow-tags origin main
    4. dotnet pack
    5. dotnet nuget push

versionize does the following:

  1. bumps the version in your .csproj file (based on your commit history)
  2. uses conventional-changelog to update CHANGELOG.md
  3. commits .csproj file and CHANGELOG.md
  4. tags a new release

Installation

dotnet tool install --global Versionize

Usage

Usage: versionize [command] [options]

Options:
  -?|-h|--help                         Show help information.
  -v|--version                         Show version information.
  -w|--workingDir <WORKING_DIRECTORY>  Directory containing projects to version
  -d|--dry-run                         Skip changing versions in projects, changelog generation and git commit
  --skip-dirty                         Skip git dirty check
  -r|--release-as <VERSION>            Specify the release version manually
  --silent                             Suppress output to console
  --skip-commit                        Skip commit and git tag after updating changelog and incrementing the
                                       version
  --skip-tag                           Skip git tag after making release commit
  -i|--ignore-insignificant-commits    Do not bump the version if no significant commits (fix, feat or BREAKING)
                                       are found
  --exit-insignificant-commits         Exits with a non zero exit code if no significant commits (fix, feat or
                                       BREAKING) are found
  --changelog-all                      Include all commits in the changelog not just fix, feat and breaking changes
  --commit-suffix                      Suffix to be added to the end of the release commit message (e.g. [skip ci])
  -p|--pre-release                     Release as pre-release version with given pre release label.
  -a|--aggregate-pre-releases          Include all pre-release commits in the changelog since the last full version. Only applies when new version is stable (non pre-release).
  --proj-version-bump-logic            [DEPRECATED] Use --find-release-commit-via-message instead.
  --find-release-commit-via-message    Use commit message instead of tag to find last release commit.
  --tag-only                           Only works with git tags, does not commit or modify the csproj file.

Commands:
  inspect                              Prints the current version to stdout

Supported commit types

Every commit should be in the form <type>[optional scope]: <description> for example fix(parser): remove colon from type and scope

  • fix - will trigger a patch version increment in the next release
  • feat - will trigger a minor version increment in the next release
  • all other types - you can use any commit type but that commit type will not trigger a version increment in the next release

Breaking changes must contain a line prefixed with BREAKING CHANGE: to allow versionize recognizing a breaking change. Breaking changes can use any commit type.

Example

git commit -m "chore: update dependencies" -m "BREAKING CHANGE: this will likely break the interface"

The happy versioning walkthrough

Preparation

Create a new project with the dotnet cli

mkdir SomeProject
dotnet new classlib

Ensure that a <Version> element is contained in file SomeProject.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <Version>1.0.0</Version>
  </PropertyGroup>
</Project>

Using versionize

Now let's start committing and releasing

git init
...make some changes to "Class1.cs"
git add *
git commit -a -m "chore: initial commit"

versionize

Will add a CHANGELOG.md, add git tags and commit everything. Note that the version in SomeProject.csproj will not change since this is your first release with versionize.

...make some changes to "Class1.cs"
git commit -a -m "fix: something went wrong we need a bugfix release"

versionize

Will update CHANGELOG.md, add git tags and commit everything. Note that the version in SomeProject.csproj is now 1.0.1.

...make some changes to "Class1.cs"
git commit -a -m "feat: something really awesome coming in the next release"

versionize

Will update CHANGELOG.md, add git tags and commit everything. Note that the version in SomeProject.csproj is now 1.1.0.

...make some changes to "Class1.cs"
git commit -a -m "feat: a really cool new feature" -m "BREAKING CHANGE: the API will break. sorry"

versionize

Will update CHANGELOG.md, add git tags and commit everything. Note that the version in SomeProject.csproj is now 2.0.0 since versionize detected a breaking change since the commit note BREAKING CHANGE was used above.

Pre-releases

Versionize supports creating pre-release versions by using the --pre-release flag with a pre-release label, for example alpha.

The following workflow illustrates how pre-release workflows with versionize work.

> git commit -a -m "chore: initial commit"
> versionize
// Generates version v1.0.0

> git commit -a -m "feat: some feature"
> versionize --pre-release alpha
// Generates version v1.1.0-alpha.0

> git commit -a -m "feat: some additional feature"
> versionize --pre-release alpha
// Generates version v1.1.0-alpha.1

> git commit -a -m "feat: some breaking feature" -m "BREAKING CHANGE: This is a breaking change"
> versionize --pre-release alpha
// Generates version v2.0.0-alpha.0

> versionize
// Generates version v2.0.0

Aggregated pre-releases changelog

By default, each commit message only appears in the release it was introduced. When using the pre-release feature this can result in a fragmented changelog. For example, when promoting to a full release the user has to browse through all the pre-release sections to see what's included.

v1.0.0-alpha.0
- featA
v1.0.0-alpha.1
- featB
v1.0.0

So to get around that you can pass the --aggregate-pre-releases flag

versionize --pre-release alpha
versionize --pre-release alpha
versionize --aggregate-pre-releases

to get output like the following

v1.0.0-alpha.0
- featA
v1.0.0-alpha.1
- featB
v1.0.0
- featA
- featB

This also works together with the pre-release option

versionize --pre-release alpha --aggregate-pre-releases

Skip pre-release tags

Some developers may prefer not to tag pre-releases. Here's an example of how to achieve that:

versionize --pre-release alpha --skip-tag --proj-version-bump-logic

proj-version-bump-logic is necessary because Versionize uses git tags by default to determine the current version. Without a git tag, the way we determine which commits get included in the changelog is by searching for the last commit message that starts with "chore(release):".

Configuration

You can configure versionize either by creating a .versionize JSON file the working directory.

Any of the command line parameters accepted by versionized can be provided via configuration file leaving out any -. For example skip-dirty can be provided as skipDirty in the configuration file.

Changelog customization can only be done via a .versionize file. The following is an example configuration:

{
  "changelogAll": true,
  "changelog": {
    "header": "My Changelog",
    "sections": [
      {
        "type": "feat",
        "section": "โœจ Features",
        "hidden": false
      },
      {
        "type": "fix",
        "section": "๐Ÿ› Bug Fixes",
        "hidden": true
      },
      {
        "type": "perf",
        "section": "๐Ÿš€ Performance",
        "hidden": false
      }
    ]
  }
}

Because changelogAll is true and the fix section is hidden, fix commits will appear in the a section titled "Other".

Developing

Want to do a PR and not care about setting up your development environment?

Open in Gitpod

To get prettier test outputs run dotnet test with prettier test logger

dotnet test --logger prettier

Roadmap

  • Pre Releases to allow creating beta.1, beta.2 versions
  • Support .versionrc like "standard-version" does
  • Support mono repo joint and disjoint version strategies
  • --silent command line switch to suppress commandline output
  • -i, --ignore-insignificant-commits command line switch to not create a new version if only insignificant (chore, ...) commits were done
  • GitHub URLs in changelog

versionize's People

Contributors

abudinka avatar alexgoris-kasparsolutions avatar antosubash avatar cabauman avatar dmitrylegostaev avatar github-actions[bot] avatar mobilutz avatar mumby0168 avatar nerdybynature avatar nigma143 avatar ntulip-qpac avatar saintedlama avatar sharppanda avatar smitchamwork avatar tobbe3108 avatar xixora avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

versionize's Issues

How does versionize track the version?

I am just getting started with versionize and I am trying to integrate it in our CI. I was wondering how versionize determines the current version to know what version to bump to. At times it seems to be using the version in the .csproj while at other times it seems to use the tags.

In our case we will be using the --pre-release flag for release candidates and then aggregate the changelog when we have a full release. What we do not need is a tag for every pre-release created. Just the main releases.

I was also getting different results when running versionize using the --pre-release flag when I ran a dry run , -d, and when I did not run a dry run. This also lead to some confusion as to how versionize determines the current version.

This is the output I got when I ran it with -d. Notice the version bumped from 9.0.1-rc.0 to 9.0.1-rc.1.

โˆš bumping version from 9.0.1-rc.0 to 9.0.1-rc.1 in projects

---
<a name="9.0.1-rc.1"></a>
## 9.0.1-rc.1 (2023-1-31)

### Bug Fixes

* added patch 1
* patch 2
---

โˆš updated CHANGELOG.md

This is the output I got when I did not run it with -d. Notice it says the version changed from 9.0.1-rc.0 to 9.0.1-rc.0 which is not a change at all.

โˆš bumping version from 9.0.1-rc.0 to 9.0.1-rc.0 in projects
โˆš updated CHANGELOG.md
โˆš committed changes in projects and CHANGELOG.md
โˆš tagged release as 9.0.1-rc.0

i Run `git push --follow-tags origin master` to push all changes including tags

I think this was caused because I chose not to add a tag when the pre-release 9.0.1-rc.0 was created but the dry run implies the version would be increases properly when I ran it for real.

Any help or insight on what is going on would be greatly appreciated. Please let me know if there is any more information you need.

Handle existing tags better

In case a tag already exists emit a useful error message and do not create a commit with updated version and changelog

Current error message

Unhandled exception. LibGit2Sharp.NameConflictException: tag already exists
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
   at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result)
   at LibGit2Sharp.Core.Proxy.git_tag_create(RepositoryHandle repo, String name, GitObject target, Signature tagger, String message, Boolean allowOverwrite)
   at LibGit2Sharp.TagCollection.Add(String name, GitObject target, Signature tagger, String message, Boolean allowOverwrite)
   at LibGit2Sharp.TagCollection.Add(String name, GitObject target, Signature tagger, String message)
   at Versionize.WorkingCopy.Versionize(Boolean dryrun, Boolean skipDirtyCheck, Boolean skipCommit, String releaseVersion, Boolean ignoreInsignificant, Boolean includeAllCommitsInChangelog) in C:\p\github\versionize\Versionize\WorkingCopy.cs:line 124
   at Versionize.Program.<>c__DisplayClass0_0.<Main>b__0() in C:\p\github\versionize\Versionize\Program.cs:line 36
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass148_0.<OnExecute>b__0(CancellationToken _)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Versionize.Program.Main(String[] args) in C:\p\github\versionize\Versionize\Program.cs:line 50

Versioning a monorepo

Any thoughts on supporting a monorepo?

Currently, versionize shows an error message if multiple project files have different versions.

Helm Support

Hello,

I would love to see the possibility to use versionize with helm charts.

Is that desired, in the scope, possible?

Thanks,
Jonah

Azure Release Pipeline

Hi

Thanks for such awesome tool, But is it possible to use this in my Release pipeline as task?

Exclude folder from being scanned

In the root folder of my git repository I have folder data which has subfolders created in the context of Docker containers.

Hence I don't have read or write permissions by the user running versionize, hence getting this exception when running versionize:

Unhandled exception. System.UnauthorizedAccessException: Access to the path '/home/.../data/global' is denied.

Is it possible to exclude folders from the scan done by versionize?

I tried versionize -w <folderwithprojectobeversionized> to only specify the folder where the project to be versionized but the scan still seems to happen.

My folder structure is something like:

. git
- data
  - global // this is created by a container
- src
  - folderwithprojectobeversionized

So I ran versionize -w src/folderwithprojectobeversionized.

I also tried to use -w with an absolute path.

I want to avoid deleting the data/global folder and running a chown -R myuser:myuser data/global makes the container fail.

.NET 7 Support

Hi,

it would be nice if this tool has support .NET 7. Currently, I can't use it without .NET 7.

Thanks

.NET 5 support

Hello!

Do you plan to provide a release compatible with .NET 5?

Versionize fails with repository dirty with untracked files present while git reports repo is not dirty

Versionize fails when there are files that are not tracked in the folder of the repository mentioning the repository is dirty. Git does not describe this as dirty as it is perfectly fine to have untracked files in the same folder.

I would not have expected this to be preventing versionize to run and if it was a problem I would have expected a message stating that there are untracked files, not the repo being dirty since git's dirty has a different meaning.

Support customizing the tag header link in the changelog

Current behavior: links to the tag page (example)

With standard-version, clicking on the version link in the changelog takes you to a nice diff page (example)

Maybe we should consider supporting both? .versionrc supports customizing the comparison link because it differs between providers. As an example here's the format for Bitbucket:

"compareUrlFormat": "{{host}}/{{owner}}/{{repository}}/compare/{{currentTag}}..{{previousTag}}"

Current and previous tag are reversed for Bitbucket and GitHub.

Upgrading from 1.17.0 to 1.17.1 fails git fetch

Hi,

We are using versionize tool in our GitLab CI/CD steps like this:

versioning:
  stage: release
  variables:
    # Force a deep/non-shallow fetch
    GIT_STRATEGY: fetch
    GIT_DEPTH: 0
  image: mcr.microsoft.com/dotnet/sdk:6.0-alpine
  script:
    - echo 'export PATH="$PATH:/root/.dotnet/tools"' >> ~/.bash_profile
    - source ~/.bash_profile
    - dotnet tool install --global Versionize --version 1.17.0
    - versionize

and after upgrading to from 1.17.0 to 1.17.1 we receiving an error

Error: LibGit2Sharp.NotFoundException
This is most likely caused by running versionize against a git repository cloned with depth --1.
In case you're using the actions/checkout@v2 in github actions you could specify fetch-depth: '1'.
For more detail see  https://github.com/actions/checkout
Exception detail:
LibGit2Sharp.NotFoundException: object not found - no match for id (ff1a6a984a775d514190534b8ffe0e9f0dbf1641)
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 154
   at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 172
   at LibGit2Sharp.Core.Proxy.git_revwalk_next(RevWalkerHandle walker) in /_/LibGit2Sharp/Core/Proxy.cs:line 2770
   at LibGit2Sharp.CommitLog.CommitEnumerator.MoveNext() in /_/LibGit2Sharp/CommitLog.cs:line 140
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Versionize.RespositoryExtensions.GetCommitsSinceLastVersion(Repository repository, Tag versionTag) in /home/runner/work/versionize/versionize/Versionize/RepositoryExtensions.cs:line 50
   at Versionize.WorkingCopy.Versionize(VersionizeOptions options) in /home/runner/work/versionize/versionize/Versionize/WorkingCopy.cs:line [46](https://gitlab.dev.clover.tech/iqsoft/coreplatform/-/jobs/364530#L46)
   at Versionize.Program.<>c__DisplayClass0_0.<Main>b__1() in /home/runner/work/versionize/versionize/Versionize/Program.cs:line 72
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass143_0.<OnExecute>b__0(CancellationToken _)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Versionize.Program.Main(String[] args) in /home/runner/work/versionize/versionize/Versionize/Program.cs:line 81

I tried to change GIT_STRATEGY to clone, adding --unshallow flag, and setting GIT_DEPTH: to 0 / 1 / 10000 (max depth of our repo) and nothing helped.

Could you assist please, is it a bug or something fundamentally changed that we need to reconfigure the CI/CD steps now?

No version detected when Project element has attributes

Versionize fails to detect the Version in a Visual Studio 2022 project defined like this:

๏ปฟ<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
        ...
        <Version>1.0.0</Version>
        ...
     </PropertyGroup>
</Project>

Using Versionize in a workflow creates an unhandled exception

Hi,

Run versionize --skip-commit --changelog-all -w ./Repo/
  versionize --skip-commit --changelog-all -w ./Repo/
  shell: /bin/bash -e {0}
  env:
    DOTNET_ROOT: /home/runner/.dotnet
Discovered 1 versionable projects
  * /home/runner/work/Repo/Repo.csproj
โˆš bumping version from 4.0.3 to 4.0.4 in projects
Unhandled exception. System.InvalidOperationException: Remote url https://github.com/organization/Repo is not recognized as valid GitHub HTTPS pattern
   at Versionize.GithubLinkBuilder..ctor(String pushUrl) in C:\p\github\versionize\Versionize\GithubLinkBuilder.cs:line 34
   at Versionize.ChangelogLinkBuilderFactory.CreateFor(Repository repository) in C:\p\github\versionize\Versionize\ChangelogLinkBuilderFactory.cs:line 15
   at Versionize.WorkingCopy.Versionize(Boolean dryrun, Boolean skipDirtyCheck, Boolean skipCommit, String releaseVersion, Boolean ignoreInsignificant, Boolean includeAllCommitsInChangelog) in C:\p\github\versionize\Versionize\WorkingCopy.cs:line 100
   at Versionize.Program.<>c__DisplayClass0_0.<Main>b__0() in C:\p\github\versionize\Versionize\Program.cs:line 36
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass148_0.<OnExecute>b__0(CancellationToken _)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Versionize.Program.Main(String[] args) in C:\p\github\versionize\Versionize\Program.cs:line 50

With the https pattern being "^https://github.com/(?<organization>.*?)/(?<repository>.*?)\\.git$" but there is no .git. Please advise. Workflow running on ubuntu-latest.

Versionize stopped working in Ubuntu 18.04

Versionize stopped working in Ubuntu 18.04, I'm getting the following error when I try to create changelog:

free(): invalid pointer
/home/vsts/work/_temp/513c9359-e347-4729-819c-0b31e4782f8d.sh: line 1: 3328 Aborted

Example command:
/home/vsts/work/versionize -w "health-reimbursement-ms/" -r 0.3.3 --skip-dirty --skip-commit -i

This is happening with 1.6.2,1.6.1 and 1.6.0

[BUG] false Bump version statement

the commandline respond after executing versionize updates the project version upon writing the proj file thus stating something like this

Discovered 1 versionable projects
  * C:\xxx.csproj
V bumping version from 1.2.0 to 1.2.0 in projects
V updated CHANGELOG.md
V committed changes in projects and CHANGELOG.md
V tagged release as 1.2.0

i Run `git push --follow-tags origin master` to push all changes including tags

the line bumping version should say something like 1.1.4 to 1.2.0

this is probaply fixed by moveing the message in workingcopy.cs from line 150 to line 138

alternatively one could have a look why the call of Project.WriteVersion (project.cs line 58) actually alters the result of the Project.Version property

im currently making some adjustments to the software to meet my requirements and im probably opening some issue for further discussion on the issues (Spoiler: delphi and numeric versioning support)

Unhandled exception. LibGit2Sharp.NotFoundException: object not found

LibGit2Sharp is throwing an exception when versionize is being used inside of a github action. This one of the few tools I have found that does both changelog generation and semantic versioning for .NET projects. It would be nice to automate this process from a Github Action. Any guidance on how to do this?

Exception

Unhandled exception. LibGit2Sharp.NotFoundException: object not found - no match for id (37f07590b932411758c6af8b3272d0d206386c1b)

Workflow

name: Version

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the development branch
on:
  push:
    branches: [main]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  update:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/setup-dotnet@v1
        with:
          dotnet-version: "6.0.x"
      - run: dotnet tool install --global Versionize
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.event.head.ref }}
      - name: Version
        run: versionize
      - name: Push Updates
        run: git push --follow-tags origin test-master

Support bumping 'parent' project when child project changes

We have a multi-project solution, that has a "primary" project which would be the project to (also) version any time any of the projects in the repository change.

For example, if I have project P.Primary and P.Secondary; if I make a "feat" change to P.Secondary, I would also like for P.Primary to "inherit" the "feat" increment, even if there weren't file changes specifically within P.Primary.

Yes, I realize this isn't a standard project structure, but it's also not one I'm empowered to change. Your project would be a wonderful addition, if this could be possible.

--skip-commit flag not working properly on versionize 1.8.0

When executing the following command on Azure Pipelines:

/home/vsts/work/versionize -w "<REPO>/" -r 0.29.0 --skip-dirty --skip-commit -i

We get the following error:

========================== Starting Command Output ===========================
/bin/bash --noprofile --norc /home/vsts/work/_temp/781ef2ad-159b-4e0d-9e82-a2b1bcfc5087.sh
Discovered 1 versionable projects
  * /home/vsts/work/1/s/<REPOSITORY>/CatalogMS/CatalogMS.csproj
โˆš bumping version from 0.29.0 to 0.29.0 in projects
Unhandled exception. System.InvalidOperationException: Remote url https://<ORG>@dev.azure.com/<ORG>/<PROJ>/_git/<REPO> is not recognized as valid Azure HTTPS pattern
   at Versionize.Changelog.AzureLinkBuilder..ctor(String pushUrl) in C:\p\github\versionize\Versionize\Changelog\AzureLinkBuilder.cs:line 36
   at Versionize.Changelog.LinkBuilderFactory.CreateFor(Repository repository) in C:\p\github\versionize\Versionize\Changelog\LinkBuilderFactory.cs:line 24
   at Versionize.WorkingCopy.Versionize(VersionizeOptions options) in C:\p\github\versionize\Versionize\WorkingCopy.cs:line 96
   at Versionize.Program.<>c__DisplayClass0_0.<Main>b__0() in C:\p\github\versionize\Versionize\Program.cs:line 59
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass146_0.<OnExecute>b__0(CancellationToken _)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Versionize.Program.Main(String[] args) in C:\p\github\versionize\Versionize\Program.cs:line 64
/home/vsts/work/_temp/781ef2ad-159b-4e0d-9e82-a2b1bcfc5087.sh: line 1:  5035 Aborted                 (core dumped) /home/vsts/work/versionize -w "<REPO>/" -r 0.29.0 --skip-dirty --skip-commit -i

NOTE:
We are getting the same error running versionize locally.

Version being bumped repeatedly without changes

When running versionize repeatedly without any commits being added in between (aside from the ones versionize creates with each release), it keeps bumping the version number and generating new commits, tags, etc...

I would like to see Verzionize recognizing this situation and refusing to bump the version in such a case.
Any thoughts about this?

I would be willing to make a PR for this if the author likes the idea.

Versionize are making changes when no commits

When no new commits since last version Versionize make a section in CHABGELOG.md and changing PATCH version.
In my opinion when no new commits since last version Versionize should exit with message:

No commits since last version ({projects.Version})

Color functionality broken on Windows

OS: Windows 11 Pro
OS Build: 22000.434

Color functionality isn't working for me, and based on browsing the Colorful.Console repository, it seems it might be related to newer Windows versions. Unfortunately, it looks like activity in the Colorful.Console repo has slowed down a lot these days. I'd be happy to post an issue in that repo, but thought I'd bring it up here in case you wanted to start considering alternatives or workarounds.

I cloned the Colorful.Console repo and ran an example with the following results:

Screenshot 2022-02-01 123719

Crazy stuff going on there ๐Ÿ˜…

EDIT

It's currently calling GetConsoleColorNative. When I altered that path to do color.ToNearestConsoleColor() instead, it works fine:

Screenshot 2022-02-01 132328

Might be worth just dropping the library and doing a simple extension, since you're not using the advanced features:

private static void WriteInColor<T>(Action<T> action, T target, ConsoleColor color)
{
    var oldColor = System.Console.ForegroundColor;
    System.Console.ForegroundColor = color;
    action.Invoke(target);
    System.Console.ForegroundColor = oldColor;
}

Support more commit types

See https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#type

build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
docs: Documentation only changes
feat: A new feature
fix: A bug fix
perf: A code change that improves performance
refactor: A code change that neither fixes a bug nor adds a feature
style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
test: Adding missing tests or correcting existing tests

--pre-release does not work when using custom configuration

The "--pre-release" option does not work correctly when using a custom configuration that has section types defined that aren't "fix" or "feat". "--pre-release" only works for "fix" and "feat". When using other custom defined types normally (NOT using --pre-release), will change the revision number...which is fine for now. Hopefully we can in the future be able to specify in the config if this is a minor or revision change for a specific type. If you have a commit mix of "fix/feat" and your custom type, it works. It just doesn't work if the custom type is the only commit. See examples below.

Project version used for all examples: "3.0.0"

Example Config for ".versionize":

{
  "changelog": {
    "header": "Version Release Notes",
    "sections": [
        {
            "type": "feat",
            "section": "โœจ Features",
            "hidden": false
        },
        {
            "type": "fix",
            "section": "๐Ÿ› Bug Fixes",
            "hidden": false
        },
        {
            "type": "ci",
            "section": "๐Ÿ‘ทโ€ Continuous Integration",
            "hidden": false
        }
    ]
  }
}

Example using --pre-release (Does NOT Work):

git commit -a -m "ci: performance improvements"
versionize --pre-release "alpha"

Semantic versioning conflict: the next version 3.0.0-alpha.0 would be lower than the current version 3.0.0. This can be caused by using a wrong pre-release label or release as version

Example not using --pre-release (WORKS):

git commit -a -m "ci: performance improvements"
versionize

โˆš bumping version from 3.0.0 to 3.0.1 in projects
โˆš updated CHANGELOG.md
โˆš committed changes in projects and CHANGELOG.md
โˆš tagged release as 3.0.1

Example using --pre-release (WORKS):

git commit -a -m "ci: performance improvements"
git commit -a -m "fix: Main page wouldn't load"
versionize --pre-release "alpha"

โˆš bumping version from 3.0.0 to 3.0.1-alpha.0 in projects
โˆš updated CHANGELOG.md
โˆš committed changes in projects and CHANGELOG.md
โˆš tagged release as 3.0.1-alpha.0

version not bumping

Hi, nice project.

I'm finding that the version will not auto-bump. I must use -r to get the correct version otherwise it says changing from 2.0.0 to 2.0.0 then hits an exception trying to create the tag because one already exists. I would expect it to go to 2.0.1 due to a fix: commit. It correctly creates the changeling with the fix listed. I also tried with feat and BREAKING CHANGE: and the changelog is updated corrected but the version is unchanged. Thanks.

Option to add / change keywords

I think it is a good idea to make the keywords for specific increment types configurable. Like "feat" and "feature" should result as the same.

Maybe an idea to extend the "section" part and add a list of keywords to trigger that section.

Support for projects with common.props?

Thanks for this cool project. It helped me a lot.

The question I have is there any plan to support common.props. I used to manage version in the single place but now the version is mentioned in multiple places.

Use 4 position version

We use 4 position versions, as in V2.1.3.4, which represents major.minor.feature.bug. I would like to see an option that allows setting which position should be changed. For example, in .versionize

{
  "versioning":  {
    "positions": [
      {
        "type": "feat",
        "position": 3
      },
      {
       "type": "fix",
       "position": 4
      }, 
      {
        "type": "release",
        "position": 1
      },
      {
        "type": "update",
        "position": 2
      }
    ]
  }
}

Add option to aggregate pre-release changes

This was requested in standard-version a long time ago but still hasn't made it in. I think it's a very common use case.

Currently, the following sequence of commands

versionize --pre-release alpha
versionize --pre-release alpha
versionize

would generate a changelog resembling

v1.0.0-alpha.0
- featA
v1.0.0-alpha.1
- featB
v1.0.0

But I propose something like

versionize --pre-release alpha
versionize --pre-release alpha
versionize --aggregate-pre-releases

to get output like

v1.0.0-alpha.0
- featA
v1.0.0-alpha.1
- featB
v1.0.0
- featA
- featB

Can also be used together with the pre-release flag

versionize --pre-release alpha --aggregate-pre-releases

Related standard-version tickets

conventional-changelog/standard-version#203
conventional-changelog/standard-version#827

Overwrite section header for other

Maybe it is good to let users change the header of the changelog title "others" so that users can modify all parts in the generated changelog file?

Versioning of *.csproj

Hi

I would like to adjust versionize to work for the workflow I use, before I send a Pull Request I want to discuss my suggestion. there is a "Directory.Build.props" file in the root directory. It contains the attributes VersionPrefix and VersionSuffix. I expect versionize to pick to increment the VersionPrefix.

Example of a the file:

๏ปฟ<?xml version="1.0" encoding="utf-8"?>
<Project>
  <PropertyGroup>
    <VersionPrefix>1.0.0</VersionPrefix>
    <VersionSuffix>rc1</VersionSuffix>
    <Authors />
    <Product>Xy</Product>
    <RepositoryUrl />
    <Nullable>enable</Nullable>
  </PropertyGroup>
</Project>

My suggestion is simply to extend the Discover-method of Projects.cs to scan also for *.props. Furthermore, Project.cs has to be adjusted to pick and write to VersionPrefix, if it is present. Else use Version like it does now.
These changes make also other scenarios possible where one uses Version in the .props file or also using VersionPrefix int .csproj files.

Let me know what you think.

Marc

Author name Issue

Hi
While running the Versionize Command in Azure DevOps release pipeline using Command Prompt, I am getting this error.
โˆš bumping version from 1.0.1 to 1.0.2 in projects โˆš updated CHANGELOG.md Unhandled Exception: System.ArgumentNullException: Value cannot be null. Parameter name: author at LibGit2Sharp.ObjectDatabase.CreateCommit(Signature author, Signature committer, String message, Tree tree, IEnumerable1 parents, Boolean prettifyMessage, Nullable1 commentChar) at LibGit2Sharp.Repository.Commit(String message, Signature author, Signature committer, CommitOptions options) at LibGit2Sharp.RepositoryExtensions.Commit(IRepository repository, String message, Signature author, Signature committer) at Versionize.WorkingCopy.Versionize(Boolean dryrun, Boolean skipDirtyCheck, Boolean skipCommit, String releaseVersion) in C:\p\github\versionize\Versionize\WorkingCopy.cs:line 116 at Versionize.Program.<>c__DisplayClass0_0.<Main>b__0() in C:\p\github\versionize\Versionize\Program.cs:line 34 at Versionize.Program.Main(String[] args) in C:\p\github\versionize\Versionize\Program.cs:line 45

But When I run the Versionize Command Locally, i am not getting any error.

Add possibility to skip changelog for pre releases

In order to avoid duplications in the changelog, it would be nice to have an options like --skip-changelog that allow to skip changelog writing with pre-releases.

To summarize with an example:

versionize --pre-release alpha
versionize --pre-release alpha
versionize --aggregate-pre-releases

Will actually produce

v1.0.0-alpha.0

  • featA
    v1.0.0-alpha.1
  • featB
    v1.0.0
  • featA
  • featB

Request scope is

versionize --pre-release alpha --skip-changelog
versionize --pre-release alpha --skip-changelog
versionize --aggregate-pre-releases

Will produce

v1.0.0

  • featA
  • featB

A more optimal alternatives is an option that delete alpha.0 and alpha.1 from the changelog when a stable is released. In this way we can see changelog of --pre-release until a stable is released.

The flow will be

versionize --pre-release alpha 
versionize --pre-release alpha

v1.0.0-alpha.0

  • featA
    v1.0.0-alpha.1
  • featB
versionize --aggregate-pre-releases --skip-prerelease-changelog

v1.0.0

  • featA
  • featB

feature: additional flags (--skip-commit-but-tag, --skip-csproj)

I have been looking at conventional commits for a while in the .NET space for a while.

I have an idea of how I'd like to implement it but the tools so far haven't had the option set I need, I think with a small set of additional options this library might be able to do what I need.

The idea is that I'd like to use git tags only to manage the versioning and keep the changelog.md files in a repo of it's own. The reason for this is to not have additional release commits in main I'd simply like to trigger a release manually generate the file, push that to another repo and then tag the commit with the new version number via this tool.

In order to do this I'd like an option to skip the auto commit but still perform the git tag, it would also be nice to have to add the additional bits to the csproj, hence the two additional flags I am proposing.

Happy to start working on this is it's suitable for this project?

Thanks,
Billy

feature request: control naming of version tag (omit ' v' prefix)

Hi ๐Ÿ‘‹๐Ÿป

First of all, thank you for your amazing project! I added it yesterday to a couple of my projects and it works very well ๐Ÿ‘๐Ÿป

One thing that I stumbled upon was using the Git tag created by versionize as Docker image tag and the tag's v prefix. For example, let's assume calling dotnet versionize creates a new Git tag v3.0.0. Now when creating a Docker image for this release via GitHub Actions, I have to shorten the Git tag like this so that my final image is tagged mu88/raspifancontroller:3.0.0 instead of mu88/raspifancontroller:v3.0.0 (which would happen when using ${{ github.ref_name }}):

    - name: Write release version
      run: |
        VERSION=${GITHUB_REF_NAME#v}
        echo Version: $VERSION
        echo "VERSION=$VERSION" >> $GITHUB_ENV
    - name: Build Docker and Push
      run: dotnet publish RaspiFanController/RaspiFanController.csproj --os linux --arch arm64 /t:PublishContainer '-p:ContainerImageTags="${{ env.VERSION }};latest"'

Since I had to insert this snippet into each of my Release pipeline, it would be cool if I could instruct versionize to create a Git tag without the v prefix (i. e. 3.0.0 instead of v3.0.0).

Support dotnet 8.0?

Is there a plan to support dotnet 8.0?

I tried to use versionize on bitbucket with the container dotnet/sdk:8.0 and in that container the command fails because versionize does not support dotnet 8.0 yet.

Thanks in advance

use tagName instead of annotated tag

What is the reason of using annotation tag message instead of tag name.
Could we do:
return repository.Tags.SingleOrDefault(t => t.FriendlyName == $"v{version}");
instead of:
return repository.Tags.SingleOrDefault(t => t.IsAnnotated && t.Annotation.Name == $"v{version}");

set a configuration file .versionrc like "standard-version" exist in node.js

I don't know if you know a lib called standard-version in node.js, I like it a lot, but it works only in javascript projects with node.

I made a task in my pipeline that it generates the tag and the changelog and already pulls the branch I'm working on.
it made my life too easy.

your lib is perfect also for those who have dotnet projects.

however I missed something that was in the lib in node.js that I think is not difficult to implement in your lib.

A configuration file like .versionrc.json, where we can place the url to see the commit on provider by sha hash, comparison between versions, title of the changelog, add other types of sections (chore, refactor, docs, build, test, etc..).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.