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

Fatal ERROR when using "tagName" #761

Closed
SimoneCusimano opened this issue Apr 27, 2021 · 5 comments
Closed

Fatal ERROR when using "tagName" #761

SimoneCusimano opened this issue Apr 27, 2021 · 5 comments

Comments

@SimoneCusimano
Copy link

Hi,
I am using the tagName attribute to filter the latest tag that the tool retrieves to generate the new version.

I am getting the following error:

$ git tag --annotate --message Release 21.04.3 [0-9][0-9].[0-1][0-9].[0-9]*
ERROR fatal: '[0-9][0-9].[0-1][0-9].[0-9]*' is not a valid tag name.

It seems that the tool uses it as a version value causing the error.

I assume the error is in the tag function of the lib/plugin/git/Git.js file. In particular, in these lines, the attribute that is passed to the git tag command should probably be version instead of tagName.

I am using release-it with the following configuration:

{
  "hooks": {
    "after:release": "echo ${version} > VERSION && echo ${latestVersion} > LATEST_VERSION"
  },
  "git": {
    "commit": false,
    "requireUpstream": false,
    "requireCleanWorkingDir": false,
    "tagName" : "[0-9][0-9].[0-1][0-9].[0-9]*"
  },
  "npm": {
    "publish": false,
    "ignoreVersion": true,
    "skipChecks": true
  },
  "plugins": {
    "@csmith/release-it-calver-plugin": {
      "format": "YY.0M.MICRO"
    }
  },
  "verbose": 2
}

Complete logs follow here:

+ npx release-it --ci --disable-metrics

$ git rev-parse --abbrev-ref HEAD

develop

$ git config --get branch.develop.remote

$ git remote get-url origin

http://REPO_URL.git

$ git fetch

From http://REPO_URL

 * [new tag]         21.04.1    -> 21.04.1

* [new tag]         21.04.2    -> 21.04.2

 * [new tag]         R21-sp04   -> R21-sp04

$ git describe --tags --match=[0-9][0-9].[0-1][0-9].[0-9]* --abbrev=0

21.04.2

$ git log --pretty=format:"* %s (%h)" 21.04.2...HEAD

* Fix name (98607b7)

* Restore Integration branch (8753f73)

🚀 Let's release COMPONENT_NAME (21.04.2...21.04.3)

Changelog:

* Fix name (98607b7)

* Restore Integration branch (8753f73)

$ git tag --annotate --message Release 21.04.3 [0-9][0-9].[0-1][0-9].[0-9]*

ERROR fatal: '[0-9][0-9].[0-1][0-9].[0-9]*' is not a valid tag name.
@webpro
Copy link
Collaborator

webpro commented Apr 30, 2021

I am using the tagName attribute to filter the latest tag that the tool retrieves to generate the new version.

The tagName is the template for the next tag to be released. This template is also used for the --match argument to find the latest tag. See #722 for more context (which is the PR introducing this).

The implementation you refer to uses the tagName from its context (the version is used by the git.tagName template option and the result is stored as tagName in the context).

@stale
Copy link

stale bot commented Jun 30, 2021

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix label Jun 30, 2021
@TheRealWaldo
Copy link

@webpro I noticed this happens if there are not yet any tags in the repository (i.e. a fresh repo). I have worked around it by manually adding a tag, but it's a bit annoying when creating many new projects.

@stale stale bot removed the wontfix label Jul 6, 2021
@SimoneCusimano
Copy link
Author

Same here

@webpro
Copy link
Collaborator

webpro commented Aug 8, 2021

I added git.tagMatch in v14.11.0

Could you please open a new issue for problematic cases without any tags yet in the repo? I can't reproduce here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants