Skip to content

Commit

Permalink
fix: Force push release branch in bump-crates (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzypixelz authored Apr 15, 2024
1 parent 24d267a commit dfe9edc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion dist/bump-crates-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -82357,14 +82357,16 @@ async function main(input) {
check: false,
});
}
command_sh(`git push ${remote} ${input.branch}`, { cwd: repo });
const tagExists = command_sh("git tag", { cwd: repo }).split("\n").includes(input.version);
if (tagExists) {
lib_core.info(`Tag ${input.version} already exists and will be replaced`);
// NOTE(fuzzypixelz): If the tag exists, then the branch exists too nad has to be pushed
command_sh(`git push --force ${remote} ${input.branch}`, { cwd: repo });
command_sh(`git tag --force ${input.version} --message v${input.version}`, { cwd: repo, env: gitEnv });
command_sh(`git push --force ${remote} ${input.version}`, { cwd: repo });
}
else {
command_sh(`git push ${remote} ${input.branch}`, { cwd: repo });
command_sh(`git tag ${input.version} --message v${input.version}`, { cwd: repo, env: gitEnv });
command_sh(`git push ${remote} ${input.version}`, { cwd: repo });
}
Expand Down
5 changes: 3 additions & 2 deletions src/bump-crates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@ export async function main(input: Input) {
});
}

sh(`git push ${remote} ${input.branch}`, { cwd: repo });

const tagExists = sh("git tag", { cwd: repo }).split("\n").includes(input.version);
if (tagExists) {
core.info(`Tag ${input.version} already exists and will be replaced`);
// NOTE(fuzzypixelz): If the tag exists, then the branch exists too nad has to be pushed
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 });
} else {
sh(`git push ${remote} ${input.branch}`, { cwd: repo });
sh(`git tag ${input.version} --message v${input.version}`, { cwd: repo, env: gitEnv });
sh(`git push ${remote} ${input.version}`, { cwd: repo });
}
Expand Down

0 comments on commit dfe9edc

Please # to comment.