Open chuckdumont opened 4 years ago
Do you maybe want to create a PR for this? 🙏
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?
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
}
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?
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: