@@ -50,7 +50,7 @@ exports.init = init;
50
50
function generateBranch ( ) {
51
51
return __awaiter ( this , void 0 , void 0 , function * ( ) {
52
52
try {
53
- console . log ( `Creating ${ constants_1 . action . branch } branch...` ) ;
53
+ console . log ( `Creating ${ constants_1 . action . branch } branch... 🔧 ` ) ;
54
54
yield util_1 . execute ( `git switch ${ constants_1 . action . baseBranch || "master" } ` , constants_1 . workspace ) ;
55
55
yield util_1 . execute ( `git switch --orphan ${ constants_1 . action . branch } ` , constants_1 . workspace ) ;
56
56
yield util_1 . execute ( `git reset --hard` , constants_1 . workspace ) ;
@@ -60,10 +60,10 @@ function generateBranch() {
60
60
yield util_1 . execute ( `git switch ${ constants_1 . action . baseBranch || "master" } ` , constants_1 . workspace ) ;
61
61
}
62
62
catch ( error ) {
63
- core . setFailed ( `There was an error creating the deployment branch: ${ error } ` ) ;
63
+ core . setFailed ( `There was an error creating the deployment branch: ${ error } ❌ ` ) ;
64
64
}
65
65
finally {
66
- return Promise . resolve ( "Deployment branch creation step complete..." ) ;
66
+ return Promise . resolve ( "Deployment branch creation step complete... ✅ " ) ;
67
67
}
68
68
} ) ;
69
69
}
@@ -96,7 +96,7 @@ function deploy() {
96
96
excludedItems . forEach ( ( item ) => ( excludes += `--exclude ${ item } ` ) ) ;
97
97
}
98
98
catch ( _a ) {
99
- console . log ( "There was an error parsing your CLEAN_EXCLUDE items. Please refer to the README for more details." ) ;
99
+ console . log ( "There was an error parsing your CLEAN_EXCLUDE items. Please refer to the README for more details. ❌ " ) ;
100
100
}
101
101
}
102
102
/*
@@ -110,14 +110,20 @@ function deploy() {
110
110
: "" } --exclude .git --exclude .github ${ constants_1 . action . build === constants_1 . root ? `--exclude ${ temporaryDeploymentDirectory } ` : "" } `, constants_1 . workspace ) ;
111
111
const hasFilesToCommit = yield util_1 . execute ( `git status --porcelain` , temporaryDeploymentDirectory ) ;
112
112
if ( ! hasFilesToCommit && ! constants_1 . isTest ) {
113
- console . log ( "There is nothing to commit. Exiting..." ) ;
113
+ console . log ( "There is nothing to commit. Exiting... ✅ " ) ;
114
114
return Promise . resolve ( ) ;
115
115
}
116
116
// Commits to GitHub.
117
117
yield util_1 . execute ( `git add --all .` , temporaryDeploymentDirectory ) ;
118
118
yield util_1 . execute ( `git switch -c ${ temporaryDeploymentBranch } ` , temporaryDeploymentDirectory ) ;
119
119
yield util_1 . execute ( `git commit -m "Deploying to ${ constants_1 . action . branch } from ${ constants_1 . action . baseBranch } ${ process . env . GITHUB_SHA } " --quiet` , temporaryDeploymentDirectory ) ;
120
120
yield util_1 . execute ( `git push --force ${ constants_1 . repositoryPath } ${ temporaryDeploymentBranch } :${ constants_1 . action . branch } ` , temporaryDeploymentDirectory ) ;
121
+ // Cleans up temporary files/folders and restores the git state.
122
+ if ( process . env . GITHUB_SHA ) {
123
+ console . log ( "Running post deployment cleanup jobs... 🔧" ) ;
124
+ yield util_1 . execute ( `rm -rf ${ temporaryDeploymentDirectory } ` , constants_1 . workspace ) ;
125
+ yield util_1 . execute ( `git checkout --progress --force ${ process . env . GITHUB_SHA } ` , constants_1 . workspace ) ;
126
+ }
121
127
return Promise . resolve ( "Commit step complete..." ) ;
122
128
} ) ;
123
129
}
0 commit comments