Merge pull request #35 from mikepenz/feature/retrieve_tag_from_context.ref
Retrieve `toTag` from github.ref
This commit is contained in:
+15
-5
@@ -48,11 +48,21 @@ async function run(): Promise<void> {
|
|||||||
const ignorePreReleases = core.getInput('ignorePreReleases')
|
const ignorePreReleases = core.getInput('ignorePreReleases')
|
||||||
|
|
||||||
if (!toTag) {
|
if (!toTag) {
|
||||||
// if not specified try to retrieve tag from git
|
// if not specified try to retrieve tag from github.context.ref
|
||||||
const gitHelper = await createCommandManager(repositoryPath)
|
if (github.context.ref.startsWith('refs/tags/')) {
|
||||||
const latestTag = await gitHelper.latestTag()
|
toTag = github.context.ref.replace('refs/tags/', '')
|
||||||
toTag = latestTag
|
core.info(
|
||||||
core.debug(`toTag = '${latestTag}'`)
|
`🔖 Resolved current tag (${toTag}) from the 'github.context.ref'`
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
// if not specified try to retrieve tag from git
|
||||||
|
const gitHelper = await createCommandManager(repositoryPath)
|
||||||
|
const latestTag = await gitHelper.latestTag()
|
||||||
|
toTag = latestTag
|
||||||
|
core.info(
|
||||||
|
`🔖 Resolved current tag (${toTag}) from 'git rev-list --tags --skip=0 --max-count=1'`
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!owner || !repo) {
|
if (!owner || !repo) {
|
||||||
|
|||||||
Reference in New Issue
Block a user