Compare commits

..

8 Commits

Author SHA1 Message Date
peaceiris
354d78ff6f chore(release): 3.0.3
Some checks failed
Release / release (push) Has been cancelled
2020-02-06 15:40:04 +09:00
peaceiris
7605281c4b chore(release): Add build assets 2020-02-06 15:40:03 +09:00
peaceiris
2948e5eda8 docs: update example of publish_branch 2020-02-06 15:39:37 +09:00
peaceiris
e8d0817a48 chore(release): Remove build assets [skip ci] 2020-02-06 15:22:10 +09:00
peaceiris
9d8382b381 chore(release): 3.0.3-0
Some checks failed
Release / release (push) Has been cancelled
2020-02-06 15:22:10 +09:00
peaceiris
8ccc2d9608 chore(release): Add build assets 2020-02-06 15:22:08 +09:00
Shohei Ueda
1b6740cb30 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
2020-02-06 15:21:18 +09:00
peaceiris
479c59e6d2 chore(release): Remove build assets [skip ci] 2020-02-06 01:55:56 +09:00
8 changed files with 94 additions and 50 deletions

View File

@@ -30,7 +30,6 @@ jobs:
- 'macos-latest'
- 'windows-latest'
steps:
- uses: actions/checkout@v2
- name: Read .nvmrc
@@ -43,6 +42,12 @@ jobs:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- 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
- name: Setup mdBook

View File

@@ -2,6 +2,24 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [3.0.3](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.3-0...v3.0.3) (2020-02-06)
### docs
* update example of publish_branch ([2948e5e](https://github.com/peaceiris/actions-gh-pages/commit/2948e5eda85d99ffc20cda677353918ea9ea3f45))
## [3.0.3-0](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.2...v3.0.3-0) (2020-02-06)
### fix
* Enable to create branch for first deployment (#92) ([1b6740c](https://github.com/peaceiris/actions-gh-pages/commit/1b6740cb30fc6a5a695a015144589862eb241b7d)), closes [#92](https://github.com/peaceiris/actions-gh-pages/issues/92)
## [3.0.2](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.1...v3.0.2) (2020-02-05)

View File

@@ -149,7 +149,7 @@ on:
- master
jobs:
build-deploy:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
@@ -186,13 +186,28 @@ The above example is for [Project Pages sites]. (`<username>/<project_name>` rep
For [User and Organization Pages sites] (`<username>/<username>.github.io` repository),
we have to set `master` branch to `PUBLISH_BRANCH`.
A default value of `publish_branch` is `gh-pages`.
```yaml
on:
push:
branches:
- source # default branch
publish_branch: master # deploying branch
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- run: somebuild
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: ./public
publish_branch: master # deploying branch
```
[Project Pages sites]: https://help.github.com/en/articles/user-organization-and-project-pages#project-pages-sites

View File

@@ -8396,29 +8396,36 @@ function setRepo(inps, remoteURL) {
}
}
};
result.exitcode = yield exec.exec('git', [
'clone',
'--depth=1',
'--single-branch',
'--branch',
inps.PublishBranch,
remoteURL,
workDir
], options);
process.chdir(workDir);
if (result.exitcode === 0) {
if (inps.KeepFiles) {
core.info('[INFO] Keep existing files');
try {
result.exitcode = yield exec.exec('git', [
'clone',
'--depth=1',
'--single-branch',
'--branch',
inps.PublishBranch,
remoteURL,
workDir
], options);
if (result.exitcode === 0) {
process.chdir(workDir);
if (inps.KeepFiles) {
core.info('[INFO] Keep existing files');
}
else {
yield exec.exec('git', ['rm', '-r', '--ignore-unmatch', '*']);
}
yield copyAssets(publishDir, workDir);
return;
}
else {
yield exec.exec('git', ['rm', '-r', '--ignore-unmatch', '*']);
throw new Error(`Failed to clone remote branch ${inps.PublishBranch}`);
}
yield copyAssets(publishDir, workDir);
return;
}
else {
catch (e) {
core.info(`[INFO] first deployment, create new branch ${inps.PublishBranch}`);
core.info(e);
yield createWorkDir(workDir);
process.chdir(workDir);
yield createBranchForce(inps.PublishBranch);
yield copyAssets(publishDir, workDir);
return;
@@ -9589,9 +9596,6 @@ function setGithubToken(inps, publishRepo) {
throw new Error(`You deploy from ${inps.PublishBranch} to ${inps.PublishBranch}`);
}
}
else if (context.eventName === 'pull_request') {
throw new Error('This action does not support pull_request event now.');
}
const isPrivateRepository = (_b = payload.repository) === null || _b === void 0 ? void 0 : _b.private;
if (inps.ExternalRepository) {
throw new Error('GITHUB_TOKEN does not support to push to an external repository');

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.0.2",
"version": "3.0.3",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.0.2",
"version": "3.0.3",
"description": "GitHub Actions for GitHub Pages",
"main": "lib/index.js",
"engines": {

View File

@@ -65,36 +65,41 @@ export async function setRepo(inps: Inputs, remoteURL: string): Promise<void> {
}
}
};
result.exitcode = await exec.exec(
'git',
[
'clone',
'--depth=1',
'--single-branch',
'--branch',
inps.PublishBranch,
remoteURL,
workDir
],
options
);
process.chdir(workDir);
try {
result.exitcode = await exec.exec(
'git',
[
'clone',
'--depth=1',
'--single-branch',
'--branch',
inps.PublishBranch,
remoteURL,
workDir
],
options
);
if (result.exitcode === 0) {
process.chdir(workDir);
if (inps.KeepFiles) {
core.info('[INFO] Keep existing files');
} else {
await exec.exec('git', ['rm', '-r', '--ignore-unmatch', '*']);
}
if (result.exitcode === 0) {
if (inps.KeepFiles) {
core.info('[INFO] Keep existing files');
await copyAssets(publishDir, workDir);
return;
} else {
await exec.exec('git', ['rm', '-r', '--ignore-unmatch', '*']);
throw new Error(`Failed to clone remote branch ${inps.PublishBranch}`);
}
await copyAssets(publishDir, workDir);
return;
} else {
} catch (e) {
core.info(
`[INFO] first deployment, create new branch ${inps.PublishBranch}`
);
core.info(e);
await createWorkDir(workDir);
process.chdir(workDir);
await createBranchForce(inps.PublishBranch);
await copyAssets(publishDir, workDir);
return;

View File

@@ -100,9 +100,6 @@ export async function setGithubToken(
`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;