mirror of
https://github.com/status-im/actions-gh-pages.git
synced 2025-02-03 08:44:31 +00:00
fix: Enable to create branch for first deployment (#92)
* fix: Enable to create branch for first deployment * fix: remove pull_request * ci: remove lint-staged husky for testing * ci: Add git checkout {package-lock,package}.json
This commit is contained in:
parent
479c59e6d2
commit
1b6740cb30
7
.github/workflows/test-action.yml
vendored
7
.github/workflows/test-action.yml
vendored
@ -30,7 +30,6 @@ jobs:
|
|||||||
- 'macos-latest'
|
- 'macos-latest'
|
||||||
- 'windows-latest'
|
- 'windows-latest'
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Read .nvmrc
|
- name: Read .nvmrc
|
||||||
@ -43,6 +42,12 @@ jobs:
|
|||||||
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
|
|
||||||
|
- name: Remove lint-staged husky
|
||||||
|
run: |
|
||||||
|
npm uninstall lint-staged husky
|
||||||
|
git checkout package-lock.json package.json
|
||||||
|
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
|
||||||
- name: Setup mdBook
|
- name: Setup mdBook
|
||||||
|
@ -65,6 +65,8 @@ export async function setRepo(inps: Inputs, remoteURL: string): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
result.exitcode = await exec.exec(
|
result.exitcode = await exec.exec(
|
||||||
'git',
|
'git',
|
||||||
[
|
[
|
||||||
@ -78,10 +80,8 @@ export async function setRepo(inps: Inputs, remoteURL: string): Promise<void> {
|
|||||||
],
|
],
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
|
|
||||||
process.chdir(workDir);
|
|
||||||
|
|
||||||
if (result.exitcode === 0) {
|
if (result.exitcode === 0) {
|
||||||
|
process.chdir(workDir);
|
||||||
if (inps.KeepFiles) {
|
if (inps.KeepFiles) {
|
||||||
core.info('[INFO] Keep existing files');
|
core.info('[INFO] Keep existing files');
|
||||||
} else {
|
} else {
|
||||||
@ -91,10 +91,15 @@ export async function setRepo(inps: Inputs, remoteURL: string): Promise<void> {
|
|||||||
await copyAssets(publishDir, workDir);
|
await copyAssets(publishDir, workDir);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
throw new Error(`Failed to clone remote branch ${inps.PublishBranch}`);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
core.info(
|
core.info(
|
||||||
`[INFO] first deployment, create new branch ${inps.PublishBranch}`
|
`[INFO] first deployment, create new branch ${inps.PublishBranch}`
|
||||||
);
|
);
|
||||||
|
core.info(e);
|
||||||
await createWorkDir(workDir);
|
await createWorkDir(workDir);
|
||||||
|
process.chdir(workDir);
|
||||||
await createBranchForce(inps.PublishBranch);
|
await createBranchForce(inps.PublishBranch);
|
||||||
await copyAssets(publishDir, workDir);
|
await copyAssets(publishDir, workDir);
|
||||||
return;
|
return;
|
||||||
|
@ -100,9 +100,6 @@ export async function setGithubToken(
|
|||||||
`You deploy from ${inps.PublishBranch} to ${inps.PublishBranch}`
|
`You deploy from ${inps.PublishBranch} to ${inps.PublishBranch}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (context.eventName === 'pull_request') {
|
|
||||||
// TODO: support pull_request event
|
|
||||||
throw new Error('This action does not support pull_request event now.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const isPrivateRepository = payload.repository?.private;
|
const isPrivateRepository = payload.repository?.private;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user