release: Reset Git repo on error
parent
ba32f71f30
commit
899f2e02f3
|
@ -114,6 +114,7 @@ if (!changelog.startsWith(`# ${newVersion}\n`)) {
|
||||||
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Done with sanity checks, now it's time to make changes.
|
// Done with sanity checks, now it's time to make changes.
|
||||||
|
|
||||||
|
try {
|
||||||
console.log('Updating develop branch...');
|
console.log('Updating develop branch...');
|
||||||
run('git pull --ff-only');
|
run('git pull --ff-only');
|
||||||
|
|
||||||
|
@ -147,7 +148,22 @@ console.log('Switching back to develop...');
|
||||||
run('git checkout develop');
|
run('git checkout develop');
|
||||||
console.log('Merging master into develop...');
|
console.log('Merging master into develop...');
|
||||||
run('git merge --no-ff --no-edit master');
|
run('git merge --no-ff --no-edit master');
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err.toString());
|
||||||
|
console.warn('Resetting repository...');
|
||||||
|
console.warn('Resetting master...');
|
||||||
|
run('git checkout -f master');
|
||||||
|
run('git reset --hard @{u}');
|
||||||
|
console.warn('Resetting develop...');
|
||||||
|
run('git checkout -f develop');
|
||||||
|
run('git reset --hard @{u}');
|
||||||
|
console.warn(`Deleting ${newVersion} tag...`);
|
||||||
|
run(`git rev-parse -q --verify refs/tags/'${newVersion}' >/dev/null || exit 0; ` +
|
||||||
|
`git tag -d '${newVersion}'`);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
console.log('Building documentation...');
|
console.log('Building documentation...');
|
||||||
run('make docs');
|
run('make docs');
|
||||||
console.log('Updating ether.github.com master branch...');
|
console.log('Updating ether.github.com master branch...');
|
||||||
|
@ -156,6 +172,14 @@ console.log('Committing documentation...');
|
||||||
run(`cp -R out/doc/ ../ether.github.com/doc/v'${newVersion}'`);
|
run(`cp -R out/doc/ ../ether.github.com/doc/v'${newVersion}'`);
|
||||||
run('git add .', {cwd: '../ether.github.com/'});
|
run('git add .', {cwd: '../ether.github.com/'});
|
||||||
run(`git commit -m '${newVersion} docs'`, {cwd: '../ether.github.com/'});
|
run(`git commit -m '${newVersion} docs'`, {cwd: '../ether.github.com/'});
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err.toString());
|
||||||
|
console.warn('Resetting repository...');
|
||||||
|
console.warn('Resetting master...');
|
||||||
|
run('git checkout -f master', {cwd: '../ether.github.com/'});
|
||||||
|
run('git reset --hard @{u}', {cwd: '../ether.github.com/'});
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
console.log('Done.');
|
console.log('Done.');
|
||||||
console.log('Review the new commits and the new tag:');
|
console.log('Review the new commits and the new tag:');
|
||||||
|
|
Loading…
Reference in New Issue