From c71e1672a26f0a33284f7146ba3b33cba8667b86 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 20 Sep 2019 23:08:16 +0200 Subject: [PATCH] Snapshot forced if no tag found --- lib/main.js | 10 +++++++++- src/main.ts | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/main.js b/lib/main.js index bd74294..52c57d6 100644 --- a/lib/main.js +++ b/lib/main.js @@ -25,8 +25,16 @@ function run() { const version = core.getInput('version') || 'latest'; const args = core.getInput('args'); const goreleaser = yield installer.getGoReleaser(version); + let snapshot = ''; + if (!process.env.GITHUB_REF.startsWith('refs/tags/')) { + console.log(`⚠️ No tag found. Snapshot forced`); + snapshot = ' --snapshot'; + } + else { + console.log(`✅ ${process.env.GITHUB_REF.split('/')[2]}} tag found`); + } console.log('🏃 Running GoReleaser...'); - yield exec.exec(`${goreleaser} ${args}`); + yield exec.exec(`${goreleaser} ${args}${snapshot}`); } catch (error) { core.setFailed(error.message); diff --git a/src/main.ts b/src/main.ts index a1d5f41..4da0fec 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,8 +8,16 @@ async function run() { const args = core.getInput('args'); const goreleaser = await installer.getGoReleaser(version); + let snapshot = ''; + if (!process.env.GITHUB_REF!.startsWith('refs/tags/')) { + console.log(`⚠️ No tag found. Snapshot forced`); + snapshot = ' --snapshot'; + } else { + console.log(`✅ ${process.env.GITHUB_REF!.split('/')[2]}} tag found`); + } + console.log('🏃 Running GoReleaser...'); - await exec.exec(`${goreleaser} ${args}`); + await exec.exec(`${goreleaser} ${args}${snapshot}`); } catch (error) { core.setFailed(error.message); }