From a2b8b0bb82f811eadcf5b9b8f7ee098318e41e75 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Tue, 10 Dec 2024 16:47:51 -0600 Subject: [PATCH] ci: don't add major tag unless we're on `main` --- bin/set-major-version-tag.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/bin/set-major-version-tag.js b/bin/set-major-version-tag.js index 2b42e331c..af9cdb367 100755 --- a/bin/set-major-version-tag.js +++ b/bin/set-major-version-tag.js @@ -37,18 +37,12 @@ async function runGitCmd(args) { */ async function setMajorVersionTag() { try { - console.log( - 'kanad test', - JSON.stringify({ - GITHUB_BASE_REF: process.env.GITHUB_BASE_REF, - GITHUB_HEAD_REF: process.env.GITHUB_HEAD_REF, - GITHUB_REF: process.env.GITHUB_REF, - GITHUB_REF_NAME: process.env.GITHUB_REF_NAME, - GITHUB_REF_PROTECTED: process.env.GITHUB_REF_PROTECTED, - GITHUB_REF_TYPE: process.env.GITHUB_REF_TYPE, - GITHUB_WORKFLOW_REF: process.env.GITHUB_WORKFLOW_REF, - }), - ); + // The major version tag should only be set when releasing on the `main` branch + if (process.env.GITHUB_REF !== 'refs/heads/main') { + // eslint-disable-next-line no-console + console.warn(`Running with the following ref: ${process.env.GITHUB_REF || 'n/a'}, not setting major version tag`); + return; + } const parsedVersion = parse(pkg.version);