This commit is contained in:
James Ives 2019-11-10 14:25:18 -05:00
parent 1c6f58f10b
commit 5f7fb1eb2e
4 changed files with 6 additions and 9 deletions

View File

@ -11,9 +11,10 @@ const core = __importStar(require("@actions/core"));
const github = __importStar(require("@actions/github"));
const { pusher, repository } = github.context.payload;
exports.workspace = process.env.GITHUB_WORKSPACE;
exports.folder = core.getInput("FOLDER", { required: true });
// Required action data.
exports.action = {
build: core.getInput("FOLDER", { required: true }),
build: exports.folder === '.' ? exports.workspace : exports.folder,
gitHubRepository: repository ? repository.full_name : "",
gitHubToken: core.getInput("GITHUB_TOKEN"),
accessToken: core.getInput("ACCESS_TOKEN"),

View File

@ -73,8 +73,6 @@ exports.generateBranch = generateBranch;
*/
function deploy() {
return __awaiter(this, void 0, void 0, function* () {
const temporaryDeploymentDirectory = "temp-deployment-folder";
const temporaryDeploymentBranch = "temp-deployment-branch";
/*
Checks to see if the remote exists prior to deploying.
If the branch doesn't exist it gets created here as an orphan.
@ -84,7 +82,7 @@ function deploy() {
console.log("Deployment branch does not exist. Creating....");
yield generateBranch();
}
yield util_1.execute(`git add --all .`, constants_1.action.build);
yield util_1.execute(`git add .`, constants_1.action.build);
yield util_1.execute(`git commit -m "Deploying to ${constants_1.action.branch} from ${constants_1.action.baseBranch} ${process.env.GITHUB_SHA}" --quiet`, constants_1.action.build);
yield util_1.execute(`git push --force ${constants_1.repositoryPath} ${constants_1.action.baseBranch}:${constants_1.action.branch}`, constants_1.action.build);
/*

View File

@ -4,10 +4,11 @@ import * as github from "@actions/github";
const { pusher, repository } = github.context.payload;
export const workspace: any = process.env.GITHUB_WORKSPACE;
export const folder = core.getInput("FOLDER", { required: true });
// Required action data.
export const action = {
build: core.getInput("FOLDER", { required: true }),
build: folder === '.' ? workspace : folder,
gitHubRepository: repository ? repository.full_name : "",
gitHubToken: core.getInput("GITHUB_TOKEN"),
accessToken: core.getInput("ACCESS_TOKEN"),

View File

@ -60,9 +60,6 @@ export async function generateBranch(): Promise<any> {
* @returns {Promise}
*/
export async function deploy(): Promise<any> {
const temporaryDeploymentDirectory = "temp-deployment-folder";
const temporaryDeploymentBranch = "temp-deployment-branch";
/*
Checks to see if the remote exists prior to deploying.
If the branch doesn't exist it gets created here as an orphan.
@ -76,7 +73,7 @@ export async function deploy(): Promise<any> {
await generateBranch();
}
await execute(`git add --all .`, action.build);
await execute(`git add .`, action.build);
await execute(
`git commit -m "Deploying to ${action.branch} from ${action.baseBranch} ${process.env.GITHUB_SHA}" --quiet`,
action.build