diff --git a/canary-publish/dist/index.js b/canary-publish/dist/index.js index c208c91..f93b7fe 100644 --- a/canary-publish/dist/index.js +++ b/canary-publish/dist/index.js @@ -53711,13 +53711,32 @@ function createReleaseForTags(_a) { catch (_b) { // IGNORE: release가 없으면 진행 } + // 원하는 SHA에 태그가 이미 있는지 확인 + let tagExists = false; + try { + // git rev-parse 가 성공하면 이미 태그가 있음 + yield (0, exec_1.exec)('git', ['rev-parse', tag]); + tagExists = true; + } + catch (_c) { + tagExists = false; + } + // 태그가 없다면 원하는 SHA에 태그 생성 및 push + if (!tagExists) { + yield (0, exec_1.exec)('git', ['tag', tag, headSha]); + yield (0, exec_1.exec)('git', ['push', 'origin', tag]); + core.info(`Created and pushed tag ${tag} at ${headSha}`); + } + else { + core.info(`Tag ${tag} already exists`); + } // 커밋 로그 추출하여 릴리즈 노트 생성 const notes = getFilteredCommitMessages({ baseSha, headSha, packagePath, packageName: name }); /** * GitHub Release 생성 * @see https://cli.github.com/manual/gh_release_create */ - yield (0, exec_1.exec)('gh', ['release', 'create', tag, '--title', tag, '--notes', notes || 'No changes', '--prerelease']); + yield (0, exec_1.exec)('gh', ['release', 'create', tag, '--title', tag, '--notes', notes, '--prerelease']); core.info(`Created Release for tag: ${tag}`); } }); diff --git a/canary-publish/src/utils/publish.ts b/canary-publish/src/utils/publish.ts index 9df918d..52c0111 100644 --- a/canary-publish/src/utils/publish.ts +++ b/canary-publish/src/utils/publish.ts @@ -116,6 +116,25 @@ export async function createReleaseForTags({ // IGNORE: release가 없으면 진행 } + // 원하는 SHA에 태그가 이미 있는지 확인 + let tagExists = false + try { + // git rev-parse 가 성공하면 이미 태그가 있음 + await exec('git', ['rev-parse', tag]) + tagExists = true + } catch { + tagExists = false + } + + // 태그가 없다면 원하는 SHA에 태그 생성 및 push + if (!tagExists) { + await exec('git', ['tag', tag, headSha]) + await exec('git', ['push', 'origin', tag]) + core.info(`Created and pushed tag ${tag} at ${headSha}`) + } else { + core.info(`Tag ${tag} already exists`) + } + // 커밋 로그 추출하여 릴리즈 노트 생성 const notes = getFilteredCommitMessages({baseSha, headSha, packagePath, packageName: name}) @@ -123,7 +142,7 @@ export async function createReleaseForTags({ * GitHub Release 생성 * @see https://cli.github.com/manual/gh_release_create */ - await exec('gh', ['release', 'create', tag, '--title', tag, '--notes', notes || 'No changes', '--prerelease']) + await exec('gh', ['release', 'create', tag, '--title', tag, '--notes', notes, '--prerelease']) core.info(`Created Release for tag: ${tag}`) } }