1
0
mirror of https://github.com/angular/angular-cli.git synced 2025-05-25 16:57:51 +08:00

ci: checkout existing branch on snapshots

This commit is contained in:
Hans Larsen 2019-01-23 11:54:59 -08:00 committed by Hans
parent bf228a064c
commit b360206b31

@ -91,7 +91,12 @@ async function _publishSnapshot(
_exec('git', ['clone', url], { cwd: root }, publishLogger);
if (branch) {
_exec('git', ['checkout', '-B', branch], { cwd: destPath }, publishLogger);
// Try to checkout an existing branch, otherwise create it.
try {
_exec('git', ['checkout', branch], { cwd: destPath }, publishLogger);
} catch {
_exec('git', ['checkout', '-b', branch], { cwd: destPath }, publishLogger);
}
}
// Clear snapshot directory before publishing to remove deleted build files.