@@ -38,13 +38,8 @@ for (const [field, isRequired] of entries(fields)) {
3838
3939console . log ( 'Starting deploy to Git...' ) ;
4040console . log ( `Cloning the repository to "${ config . folder } " folder...` ) ;
41- try {
42- execSync ( `git clone -b ${ config . branch } ${ config . repository } ${ config . folder } 2>&1` , { cwd } ) ;
43- } catch ( e ) {
44- console . error ( 'Failed to clone. An original error is thrown below.' ) ;
45- throw Error ( e ) ;
46- }
4741
42+ execSync ( `git clone -b ${ config . branch } ${ config . repository } ${ config . folder } ` , { cwd } ) ;
4843
4944console . log ( `Starting script "${ config . script } "...` ) ;
5045console . log ( execSync ( `${ config . script } ` , { cwd } ) . toString ( 'utf-8' ) ) ;
@@ -55,33 +50,23 @@ execSync(`
5550 git config user.email "${ config . user_email } " &&
5651 git config user.name "${ config . user_name } " &&
5752 git add . &&
58- git commit --allow-empty -m "${ config . commit } " 2>&1
53+ git commit --allow-empty -m "${ config . commit } "
5954` , { cwd } ) ;
6055
6156if ( config . beforePushScript ) {
6257 console . log ( 'Running beforePushScript...' ) ;
6358
64- try {
65- execSync ( `
66- cd ${ config . folder } &&
67- ${ config . beforePushScript }
68- ` , { cwd } ) ;
69- } catch ( e ) {
70- console . error ( 'Failed to run beforePushScript. An original error is thrown below.' ) ;
71- throw Error ( e ) ;
72- }
73- }
74-
75- console . log ( 'Pushing...' ) ;
76- try {
7759 execSync ( `
7860 cd ${ config . folder } &&
79- git push --tags ${ config . repository } ${ config . branch } 2>&1
61+ ${ config . beforePushScript }
8062 ` , { cwd } ) ;
81- } catch ( e ) {
82- console . error ( 'Failed to push. An original error is thrown below.' ) ;
83- throw Error ( e ) ;
8463}
8564
65+ console . log ( 'Pushing...' ) ;
66+
67+ execSync ( `
68+ cd ${ config . folder } &&
69+ git push --tags ${ config . repository } ${ config . branch }
70+ ` , { cwd } ) ;
8671
8772console . log ( 'Deploying to git is finished.' ) ;
0 commit comments