mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
changes
This commit is contained in:
parent
012f0e45bb
commit
1c6f58f10b
@ -56,6 +56,8 @@ function generateBranch() {
|
||||
yield util_1.execute(`git reset --hard`, constants_1.workspace);
|
||||
yield util_1.execute(`git commit --allow-empty -m "Initial ${constants_1.action.branch} commit."`, constants_1.workspace);
|
||||
yield util_1.execute(`git push ${constants_1.repositoryPath} ${constants_1.action.branch}`, constants_1.workspace);
|
||||
// Switches back to the base branch.
|
||||
yield util_1.execute(`git switch ${constants_1.action.baseBranch || "master"}`, constants_1.workspace);
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(`There was an error creating the deployment branch: ${error}`);
|
||||
@ -82,9 +84,6 @@ function deploy() {
|
||||
console.log("Deployment branch does not exist. Creating....");
|
||||
yield generateBranch();
|
||||
}
|
||||
// Checks out the base branch to begin the deployment process.
|
||||
yield util_1.execute(`git switch ${constants_1.action.baseBranch || "master"}`, constants_1.workspace);
|
||||
yield util_1.execute(`git fetch origin`, constants_1.workspace);
|
||||
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 ${constants_1.repositoryPath} ${constants_1.action.baseBranch}:${constants_1.action.branch}`, constants_1.action.build);
|
||||
|
@ -44,6 +44,9 @@ export async function generateBranch(): Promise<any> {
|
||||
workspace
|
||||
);
|
||||
await execute(`git push ${repositoryPath} ${action.branch}`, workspace);
|
||||
|
||||
// Switches back to the base branch.
|
||||
await execute(`git switch ${action.baseBranch || "master"}`, workspace);
|
||||
} catch (error) {
|
||||
core.setFailed(
|
||||
`There was an error creating the deployment branch: ${error}`
|
||||
@ -73,10 +76,6 @@ export async function deploy(): Promise<any> {
|
||||
await generateBranch();
|
||||
}
|
||||
|
||||
// Checks out the base branch to begin the deployment process.
|
||||
await execute(`git switch ${action.baseBranch || "master"}`, workspace);
|
||||
await execute(`git fetch origin`, workspace);
|
||||
|
||||
await execute(`git add --all .`, action.build);
|
||||
await execute(
|
||||
`git commit -m "Deploying to ${action.branch} from ${action.baseBranch} ${process.env.GITHUB_SHA}" --quiet`,
|
||||
|
Loading…
Reference in New Issue
Block a user