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

Support for npm tags #4

Open
chuckdumont opened this issue Nov 17, 2019 · 4 comments
Open

Support for npm tags #4

chuckdumont opened this issue Nov 17, 2019 · 4 comments

Comments

@chuckdumont
Copy link

It would be nice if this action could support tagged releases. You could key off of the commit message for package.json. For example, "TaggedRelease beta" or "TaggedRelease next 1.2.3-rc2". With these commit messages, the action would use the --tag option with the second token in the message. For example:

npm publish --tag next
@pascalgn
Copy link
Owner

Do you maybe want to create a PR for this? 🙏

@endel
Copy link

endel commented Sep 28, 2020

Hi guys, has anyone been working on this? I'm also interested in releasing with --tag, I'm wondering if we could use the --tag automatically in case there is a dash in the version name?

Examples:

  • 1.2.3-alpha.0--tag alpha
  • 1.2.3-rc2--tag rc
  • 1.2.3-next1--tag next

The RegExp to get the tag name could simply extract a-z characters from the version string (/([a-zA-Z]+)/) and use it for the tag name. What do you think?

@endel
Copy link

endel commented Sep 28, 2020

If we go for the RegExp approach, in case the a-zA-Z characters are found we can consider using --tag:

const version = "1.2.3-alpha.0";
const tagName = version.match(/([a-zA-Z]+)/);

if (tagName) {
  // need to publish with `--tag ${tagName[1]}`
} else {
  // no need to use --tag
}

@pascalgn
Copy link
Owner

pascalgn commented Sep 29, 2020

I am thinking -- could we let the user provide a regex, for example /([0-9.]+)-(.+)/ and if the result after matching the commit message contains 1 (non-empty) group, we assume non-tagged, and with 2 groups, we assume tagged release? Alternatively, but maybe harder to implement, would be to let the users provide 2 regexes, one for normal releases, one for tagged? WDYT?

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