From 20707749ef98a44b0110dec9082d13fce4d89f07 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Wed, 23 Oct 2024 15:38:44 +0200 Subject: [PATCH] Don't tag dry-run releases --- .github/workflows/branch-bump-tag-crates.yml | 1 + bump-crates/action.yml | 2 ++ dist/bump-crates-main.js | 8 ++++++-- src/bump-crates.ts | 10 ++++++++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/branch-bump-tag-crates.yml b/.github/workflows/branch-bump-tag-crates.yml index 6b657cb..d254f82 100644 --- a/.github/workflows/branch-bump-tag-crates.yml +++ b/.github/workflows/branch-bump-tag-crates.yml @@ -78,6 +78,7 @@ jobs: - uses: eclipse-zenoh/ci/bump-crates@main with: repo: ${{ inputs.repo }} + live-run: ${{ inputs.live-run }} path: ${{ inputs.path }} version: ${{ steps.create-release-branch.outputs.version }} branch: ${{ steps.create-release-branch.outputs.branch }} diff --git a/bump-crates/action.yml b/bump-crates/action.yml index a2974a9..35cbb44 100644 --- a/bump-crates/action.yml +++ b/bump-crates/action.yml @@ -3,6 +3,8 @@ name: Bump crates inputs: version: required: true + live-run: + required: false branch: required: true repo: diff --git a/dist/bump-crates-main.js b/dist/bump-crates-main.js index 9c651d6..db8c061 100644 --- a/dist/bump-crates-main.js +++ b/dist/bump-crates-main.js @@ -81103,6 +81103,7 @@ _cargo__WEBPACK_IMPORTED_MODULE_4__ = (__webpack_async_dependencies__.then ? (aw function setup() { const version = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("version", { required: true }); + const liveRun = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getBooleanInput("live-run", { required: true }); const branch = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("branch", { required: true }); const repo = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("repo", { required: true }); const path = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("path"); @@ -81112,6 +81113,7 @@ function setup() { const bumpDepsBranch = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("bump-deps-branch"); return { version, + liveRun, branch, repo, path: path === "" ? undefined : path, @@ -81147,8 +81149,10 @@ async function main(input) { }); } (0,_command__WEBPACK_IMPORTED_MODULE_3__.sh)(`git push --force ${remote} ${input.branch}`, { cwd: repo }); - (0,_command__WEBPACK_IMPORTED_MODULE_3__.sh)(`git tag --force ${input.version} --message v${input.version}`, { cwd: repo, env: _config__WEBPACK_IMPORTED_MODULE_5__/* .gitEnv */ .B }); - (0,_command__WEBPACK_IMPORTED_MODULE_3__.sh)(`git push --force ${remote} ${input.version}`, { cwd: repo }); + if (input.liveRun) { + (0,_command__WEBPACK_IMPORTED_MODULE_3__.sh)(`git tag --force ${input.version} --message v${input.version}`, { cwd: repo, env: _config__WEBPACK_IMPORTED_MODULE_5__/* .gitEnv */ .B }); + (0,_command__WEBPACK_IMPORTED_MODULE_3__.sh)(`git push --force ${remote} ${input.version}`, { cwd: repo }); + } (0,_command__WEBPACK_IMPORTED_MODULE_3__.sh)("git log -10", { cwd: repo }); (0,_command__WEBPACK_IMPORTED_MODULE_3__.sh)("git show-ref --tags", { cwd: repo }); await cleanup(input); diff --git a/src/bump-crates.ts b/src/bump-crates.ts index b2498d1..66d6f86 100644 --- a/src/bump-crates.ts +++ b/src/bump-crates.ts @@ -9,6 +9,7 @@ import { gitEnv } from "./config"; export type Input = { version: string; + liveRun: boolean; branch: string; repo: string; path?: string; @@ -20,6 +21,7 @@ export type Input = { export function setup(): Input { const version = core.getInput("version", { required: true }); + const liveRun = core.getBooleanInput("live-run", { required: true }); const branch = core.getInput("branch", { required: true }); const repo = core.getInput("repo", { required: true }); const path = core.getInput("path"); @@ -30,6 +32,7 @@ export function setup(): Input { return { version, + liveRun, branch, repo, path: path === "" ? undefined : path, @@ -71,8 +74,11 @@ export async function main(input: Input) { } sh(`git push --force ${remote} ${input.branch}`, { cwd: repo }); - sh(`git tag --force ${input.version} --message v${input.version}`, { cwd: repo, env: gitEnv }); - sh(`git push --force ${remote} ${input.version}`, { cwd: repo }); + + if (input.liveRun) { + sh(`git tag --force ${input.version} --message v${input.version}`, { cwd: repo, env: gitEnv }); + sh(`git push --force ${remote} ${input.version}`, { cwd: repo }); + } sh("git log -10", { cwd: repo }); sh("git show-ref --tags", { cwd: repo });