Update git.js

This commit is contained in:
James Ives 2020-05-24 11:18:50 -04:00
parent 4540741d2e
commit 5df73db307

View File

@ -132,8 +132,6 @@ function deploy(action) {
yield execute_1.execute(`git commit -m "${commitMessage}" --quiet`, `${action.workspace}/${temporaryDeploymentDirectory}`);
yield execute_1.execute(`git push --force ${action.repositoryPath} ${temporaryDeploymentBranch}:${action.branch}`, `${action.workspace}/${temporaryDeploymentDirectory}`);
core_1.info(`Changes committed to the ${action.branch} branch… 📦`);
// Cleans up temporary files/folders and restores the git state.
core_1.info('Running post deployment cleanup jobs…');
if (action.singleCommit) {
yield execute_1.execute(`git fetch ${action.repositoryPath}`, action.workspace);
yield execute_1.execute(`git checkout --orphan ${action.branch}-temp`, `${action.workspace}/${temporaryDeploymentDirectory}`);
@ -150,7 +148,8 @@ function deploy(action) {
throw new Error(`The deploy step encountered an error: ${util_1.suppressSensitiveInformation(error.message, action)}`);
}
finally {
// Ensures the deployment directory is safely removed after each deployment.
// Cleans up temporary files/folders and restores the git state.
core_1.info('Running post deployment cleanup jobs… 🗑️');
yield execute_1.execute(`git worktree remove ${temporaryDeploymentDirectory}`, action.workspace);
yield io_1.rmRF(temporaryDeploymentDirectory);
}