diff --git a/lib/git.js b/lib/git.js index edbfbdab..acbc6336 100644 --- a/lib/git.js +++ b/lib/git.js @@ -17,6 +17,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(require("@actions/core")); +const io_1 = require("@actions/io"); const util_1 = require("./util"); const constants_1 = require("./constants"); /** Generates the branch if it doesn't exist on the remote. @@ -93,11 +94,15 @@ function deploy() { /* Pushes all of the build files into the deployment directory. Allows the user to specify the root if '.' is provided. */ - /*await cp(`${action.build}/.`, temporaryDeploymentDirectory, { - recursive: true, - force: true - });*/ - yield util_1.execute(`rsync -av --progress ${constants_1.action.build}/. ${temporaryDeploymentDirectory} --exclude .git ${constants_1.action.build === '.' && `--exclude ${temporaryDeploymentDirectory}`}`, constants_1.workspace); + if (constants_1.action.build === '.') { + yield util_1.execute(`rsync -av --progress ${constants_1.action.build}/. ${temporaryDeploymentDirectory} --exclude .git --exclude ${temporaryDeploymentDirectory}`, constants_1.workspace); + } + else { + yield io_1.cp(`${constants_1.action.build}/.`, temporaryDeploymentDirectory, { + recursive: true, + force: true + }); + } // Commits to GitHub. yield util_1.execute(`git add --all .`, temporaryDeploymentDirectory); yield util_1.execute(`git switch -c ${temporaryDeploymentBranch}`, temporaryDeploymentDirectory); diff --git a/src/git.ts b/src/git.ts index 196e5ce2..e72681ab 100644 --- a/src/git.ts +++ b/src/git.ts @@ -86,12 +86,17 @@ export async function deploy(): Promise { /* Pushes all of the build files into the deployment directory. Allows the user to specify the root if '.' is provided. */ - /*await cp(`${action.build}/.`, temporaryDeploymentDirectory, { - recursive: true, - force: true });*/ - await execute(`rsync -av --progress ${action.build}/. ${temporaryDeploymentDirectory} --exclude .git ${action.build === '.' && `--exclude ${temporaryDeploymentDirectory}`}`, workspace) + if (action.build === '.') { + await execute(`rsync -av --progress ${action.build}/. ${temporaryDeploymentDirectory} --exclude .git --exclude ${temporaryDeploymentDirectory}`, workspace) + } else { + await cp(`${action.build}/.`, temporaryDeploymentDirectory, { + recursive: true, + force: true + }); + + } // Commits to GitHub. await execute(`git add --all .`, temporaryDeploymentDirectory);