Skip to content

Default to last created tag in gh release create #1674

@cyrilletuzi

Description

@cyrilletuzi

Describe the feature or problem you’d like to solve

Follow up of this comment of #1552, creating a new issue as asked by @mislav.

A new gh release create command has been added, but currently the tag number is required (ie. gh release create v2.1.0).

But in an automation process, the tag creation is automated too, so you do not know directly its number. Examples of releases scripts:

  • for a VS Code extension:
vsce publish minor && git push && git push --tags
  • for a npm package:
npm run build && npm version minor && npm publish dist && git push && git push --tags;

In both cases, the tag creation is automated (by vsce publish or npm version), so we don't have access to the tag number directly.

Proposed solution

Make the tag parameter in gh release create optional, or add a keyword to use the latest created one (for example gh release create latest).

Additional context

There are workarounds, but difficult:

  • @mislav suggested the use of the output of git tag --sort=-creatordate | head -1
  • you can use $npm_package_version (but it is not cross-platform, the syntax is different is a Windows shell)

Also note that in the VS Code extension example, the packaged VSIX file will be added to the GitHub release, and its name contains the version number (ie. gh release create v2.1.0 some-extension-2.1.0.vsix).

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreThis issue is not accepting PRs from outside contributorsenhancementa request to improve CLI

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions