Update try catch blocks to revert changes on error

A failure to set the git tag returns and undoes the changes done
previously
This commit is contained in:
Cecylia Bocovich 2019-10-15 12:50:04 -04:00
parent 6e6e52fd8c
commit f74da6e0fc

View file

@ -117,6 +117,7 @@ task('pack-webext', 'pack the webextension for deployment', function() {
execSync(`rm -f source.zip`); execSync(`rm -f source.zip`);
execSync(`rm -f webext/webext.zip`); execSync(`rm -f webext/webext.zip`);
} catch (error) { } catch (error) {
//Usually this happens because the zip files were removed previously
console.log('Error removing zip files'); console.log('Error removing zip files');
} }
execSync(`git submodule update --remote`); execSync(`git submodule update --remote`);
@ -130,6 +131,11 @@ task('pack-webext', 'pack the webextension for deployment', function() {
execSync(`git tag webext-${version}`); execSync(`git tag webext-${version}`);
} catch (error) { } catch (error) {
console.log('Error creating git tag'); console.log('Error creating git tag');
// Revert changes
execSync(`git reset HEAD~`);
execSync(`git checkout ./webext/manifest.json`);
execSync(`git submodule update`);
return;
} }
execSync(`git archive -o source.zip HEAD .`); execSync(`git archive -o source.zip HEAD .`);
execSync(`npm run webext`); execSync(`npm run webext`);