mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
Debugging
This commit is contained in:
parent
3843226fed
commit
b8c623035e
45
lib/git.js
45
lib/git.js
@ -78,46 +78,19 @@ function deploy() {
|
||||
/*
|
||||
Checks to see if the remote exists prior to deploying.
|
||||
If the branch doesn't exist it gets created here as an orphan.
|
||||
*/
|
||||
const branchExists = yield util_1.execute(`git ls-remote --heads ${constants_1.repositoryPath} ${constants_1.action.branch} | wc -l`, constants_1.workspace);
|
||||
|
||||
const branchExists = await execute(
|
||||
`git ls-remote --heads ${repositoryPath} ${action.branch} | wc -l`,
|
||||
workspace
|
||||
);
|
||||
if (!branchExists) {
|
||||
console.log("Deployment branch does not exist. Creating....");
|
||||
yield generateBranch();
|
||||
}
|
||||
console.log("Deployment branch does not exist. Creating....");
|
||||
//await generateBranch();
|
||||
}*/
|
||||
console.log('list', yield util_1.execute(`ls`, constants_1.action.build));
|
||||
yield util_1.execute(`git checkout --orphan ${constants_1.action.branch}`, constants_1.action.build);
|
||||
yield util_1.execute(`git remote rm origin`, constants_1.action.build);
|
||||
yield util_1.execute(`git remote add origin ${constants_1.repositoryPath}`, constants_1.action.build);
|
||||
yield util_1.execute(`git add --all`, 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 origin ${constants_1.action.branch}`, constants_1.action.build);
|
||||
/*
|
||||
await execute(
|
||||
`git worktree add --checkout ${temporaryDeploymentDirectory} origin/${action.branch}`,
|
||||
workspace
|
||||
); */
|
||||
/*
|
||||
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
|
||||
});
|
||||
|
||||
// Commits to GitHub.
|
||||
await execute(`git add --all .`, temporaryDeploymentDirectory);
|
||||
await execute(
|
||||
`git switch -c ${temporaryDeploymentBranch}`,
|
||||
temporaryDeploymentDirectory
|
||||
);
|
||||
await execute(
|
||||
`git commit -m "Deploying to ${action.branch} from ${action.baseBranch} ${process.env.GITHUB_SHA}" --quiet`,
|
||||
temporaryDeploymentDirectory
|
||||
);
|
||||
await execute(
|
||||
`git push --force ${repositoryPath} ${temporaryDeploymentBranch}:${action.branch}`,
|
||||
temporaryDeploymentDirectory
|
||||
);*/
|
||||
yield util_1.execute(`git push --force ${constants_1.repositoryPath} ${constants_1.action.baseBranch}:${constants_1.action.branch}`, constants_1.action.build);
|
||||
return Promise.resolve("Commit step complete...");
|
||||
});
|
||||
}
|
||||
|
42
src/git.ts
42
src/git.ts
@ -63,23 +63,19 @@ export async function deploy(): Promise<any> {
|
||||
/*
|
||||
Checks to see if the remote exists prior to deploying.
|
||||
If the branch doesn't exist it gets created here as an orphan.
|
||||
*/
|
||||
|
||||
const branchExists = await execute(
|
||||
`git ls-remote --heads ${repositoryPath} ${action.branch} | wc -l`,
|
||||
workspace
|
||||
);
|
||||
if (!branchExists) {
|
||||
console.log("Deployment branch does not exist. Creating....");
|
||||
await generateBranch();
|
||||
}
|
||||
//await generateBranch();
|
||||
}*/
|
||||
|
||||
|
||||
console.log('list', await execute(`ls`, action.build))
|
||||
|
||||
await execute(`git checkout --orphan ${action.branch}`, action.build)
|
||||
await execute(`git remote rm origin`, action.build)
|
||||
await execute(`git remote add origin ${repositoryPath}`, action.build)
|
||||
|
||||
await execute(`git add --all`, action.build);
|
||||
await execute(
|
||||
`git commit -m "Deploying to ${action.branch} from ${action.baseBranch} ${process.env.GITHUB_SHA}" --quiet`,
|
||||
@ -87,39 +83,9 @@ export async function deploy(): Promise<any> {
|
||||
);
|
||||
|
||||
await execute(
|
||||
`git push --force origin ${action.branch}`,
|
||||
`git push --force ${repositoryPath} ${action.baseBranch}:${action.branch}`,
|
||||
action.build
|
||||
);
|
||||
|
||||
/*
|
||||
await execute(
|
||||
`git worktree add --checkout ${temporaryDeploymentDirectory} origin/${action.branch}`,
|
||||
workspace
|
||||
); */
|
||||
|
||||
/*
|
||||
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
|
||||
});
|
||||
|
||||
// Commits to GitHub.
|
||||
await execute(`git add --all .`, temporaryDeploymentDirectory);
|
||||
await execute(
|
||||
`git switch -c ${temporaryDeploymentBranch}`,
|
||||
temporaryDeploymentDirectory
|
||||
);
|
||||
await execute(
|
||||
`git commit -m "Deploying to ${action.branch} from ${action.baseBranch} ${process.env.GITHUB_SHA}" --quiet`,
|
||||
temporaryDeploymentDirectory
|
||||
);
|
||||
await execute(
|
||||
`git push --force ${repositoryPath} ${temporaryDeploymentBranch}:${action.branch}`,
|
||||
temporaryDeploymentDirectory
|
||||
);*/
|
||||
|
||||
|
||||
return Promise.resolve("Commit step complete...");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user