Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
381bc0b884 | ||
|
|
3914720f25 | ||
|
|
f53ab0c2a5 | ||
|
|
6b76e36ab3 | ||
|
|
a4205cbdd8 | ||
|
|
d753ac9b7d | ||
|
|
488b74cc9f | ||
|
|
16d58bea33 | ||
|
|
a8941b89c6 | ||
|
|
0413b987d2 |
21
CHANGELOG.md
21
CHANGELOG.md
@@ -2,6 +2,27 @@
|
|||||||
|
|
||||||
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.
|
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.6.3](https://github.com/peaceiris/actions-gh-pages/compare/v3.6.2...v3.6.3) (2020-07-14)
|
||||||
|
|
||||||
|
|
||||||
|
### deps
|
||||||
|
|
||||||
|
* bump @types/node from 12.12.48 to 12.12.50 (#392) ([a4205cb](https://github.com/peaceiris/actions-gh-pages/commit/a4205cbdd8cd3a11aee9c47b7f9d99a615b70a21)), closes [#392](https://github.com/peaceiris/actions-gh-pages/issues/392)
|
||||||
|
* bump standard-version from 8.0.0 to 8.0.1 (#391) ([6b76e36](https://github.com/peaceiris/actions-gh-pages/commit/6b76e36ab31b40e721fdf587221239d94ca5d141)), closes [#391](https://github.com/peaceiris/actions-gh-pages/issues/391)
|
||||||
|
|
||||||
|
### docs
|
||||||
|
|
||||||
|
* Add dependabot.yml example (#385) ([a8941b8](https://github.com/peaceiris/actions-gh-pages/commit/a8941b89c6f5476753fcdadcacbfb73206faefb3)), closes [#385](https://github.com/peaceiris/actions-gh-pages/issues/385)
|
||||||
|
* add notes #349 (#387) ([488b74c](https://github.com/peaceiris/actions-gh-pages/commit/488b74cc9f861adb4649850096fb9f367363c096)), closes [#349](https://github.com/peaceiris/actions-gh-pages/issues/349) [#387](https://github.com/peaceiris/actions-gh-pages/issues/387)
|
||||||
|
* Add Schedule and Manual Deployment (#386) ([16d58be](https://github.com/peaceiris/actions-gh-pages/commit/16d58bea333f07b6141ab6d6f95dca541fde8853)), closes [#386](https://github.com/peaceiris/actions-gh-pages/issues/386)
|
||||||
|
* pin actions/setup-node from v2 to v2.1.0 (#389) ([d753ac9](https://github.com/peaceiris/actions-gh-pages/commit/d753ac9b7dd593b0877d35bc997ea8665c73866c)), closes [#389](https://github.com/peaceiris/actions-gh-pages/issues/389) [#388](https://github.com/peaceiris/actions-gh-pages/issues/388)
|
||||||
|
|
||||||
|
### fix
|
||||||
|
|
||||||
|
* isProhibitedBranch detection (#394) ([f53ab0c](https://github.com/peaceiris/actions-gh-pages/commit/f53ab0c2a5d3f3b2e6524639bae8ca84e454e049)), closes [#394](https://github.com/peaceiris/actions-gh-pages/issues/394)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [3.6.2](https://github.com/peaceiris/actions-gh-pages/compare/v3.6.1...v3.6.2) (2020-07-08)
|
## [3.6.2](https://github.com/peaceiris/actions-gh-pages/compare/v3.6.1...v3.6.2) (2020-07-08)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
66
README.md
66
README.md
@@ -36,7 +36,12 @@ Three tokens are supported.
|
|||||||
| `deploy_key` | ✅️ | ✅️ | SSH | Necessary |
|
| `deploy_key` | ✅️ | ✅️ | SSH | Necessary |
|
||||||
| `personal_token` | ✅️ | ✅️ | HTTPS | Necessary |
|
| `personal_token` | ✅️ | ✅️ | HTTPS | Necessary |
|
||||||
|
|
||||||
Notes: Actually, the `GITHUB_TOKEN` works for deploying to GitHub Pages but it has still some limitations. For the first deployment, we need to select the `gh-pages` branch or `master` branch on the repository settings tab. See [First Deployment with `GITHUB_TOKEN`](#%EF%B8%8F-first-deployment-with-github_token)
|
Notes: Actually, the `GITHUB_TOKEN` works for deploying to GitHub Pages but it has still some limitations.
|
||||||
|
For the first deployment, we need to select the `gh-pages` branch or `master` branch on the repository settings tab.
|
||||||
|
See [First Deployment with `GITHUB_TOKEN`](#%EF%B8%8F-first-deployment-with-github_token)
|
||||||
|
|
||||||
|
And you may need to push manually for the first deployment on a private repository.
|
||||||
|
See [Issue #349](https://github.com/peaceiris/actions-gh-pages/issues/349)
|
||||||
|
|
||||||
### Supported Platforms
|
### Supported Platforms
|
||||||
|
|
||||||
@@ -82,6 +87,7 @@ All Actions runners: Linux (Ubuntu), macOS, and Windows are supported.
|
|||||||
- [⭐️ Create SSH Deploy Key](#%EF%B8%8F-create-ssh-deploy-key)
|
- [⭐️ Create SSH Deploy Key](#%EF%B8%8F-create-ssh-deploy-key)
|
||||||
- [⭐️ First Deployment with `GITHUB_TOKEN`](#%EF%B8%8F-first-deployment-with-github_token)
|
- [⭐️ First Deployment with `GITHUB_TOKEN`](#%EF%B8%8F-first-deployment-with-github_token)
|
||||||
- [⭐️ Use the latest and specific release](#%EF%B8%8F-use-the-latest-and-specific-release)
|
- [⭐️ Use the latest and specific release](#%EF%B8%8F-use-the-latest-and-specific-release)
|
||||||
|
- [⭐️ Schedule and Manual Deployment](#%EF%B8%8F-schedule-and-manual-deployment)
|
||||||
- [Examples](#examples)
|
- [Examples](#examples)
|
||||||
- [⭐️ Static Site Generators with Node.js](#%EF%B8%8F-static-site-generators-with-nodejs)
|
- [⭐️ Static Site Generators with Node.js](#%EF%B8%8F-static-site-generators-with-nodejs)
|
||||||
- [⭐️ Gatsby](#%EF%B8%8F-gatsby)
|
- [⭐️ Gatsby](#%EF%B8%8F-gatsby)
|
||||||
@@ -348,7 +354,7 @@ When you use `deploy_key`, set your private key to the repository which includes
|
|||||||
|
|
||||||
**Note that `GITHUB_TOKEN` has no permission to access to external repositories. Please create a personal access token and set it to `personal_token` like `personal_token: ${{ secrets.PERSONAL_TOKEN }}`.**
|
**Note that `GITHUB_TOKEN` has no permission to access to external repositories. Please create a personal access token and set it to `personal_token` like `personal_token: ${{ secrets.PERSONAL_TOKEN }}`.**
|
||||||
|
|
||||||
Use case:
|
Use case:
|
||||||
|
|
||||||
A GitHub Free Plan account cannot use the GitHub Pages in a private repository. To make your source contents private and deploy it with the GitHub Pages, you can deploy your site from a private repository to a public repository using this option.
|
A GitHub Free Plan account cannot use the GitHub Pages in a private repository. To make your source contents private and deploy it with the GitHub Pages, you can deploy your site from a private repository to a public repository using this option.
|
||||||
|
|
||||||
@@ -518,6 +524,50 @@ It is useful to watch this repository (release only) to check the [latest releas
|
|||||||
|
|
||||||
[latest release]: https://github.com/peaceiris/actions-gh-pages/releases
|
[latest release]: https://github.com/peaceiris/actions-gh-pages/releases
|
||||||
|
|
||||||
|
For continuous updating, we can use the GitHub native Dependabot.
|
||||||
|
Here is an example configuration of the bot. The config file is located in `.github/dependabot.yml`.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
labels:
|
||||||
|
- "dependencies:ci"
|
||||||
|
commit-message:
|
||||||
|
prefix: ci
|
||||||
|
```
|
||||||
|
|
||||||
|
See the official documentation for more details about the Dependabot: [Keeping your dependencies updated automatically - GitHub Docs](https://docs.github.com/en/github/administering-a-repository/keeping-your-dependencies-updated-automatically)
|
||||||
|
|
||||||
|
### ⭐️ Schedule and Manual Deployment
|
||||||
|
|
||||||
|
For deploying regularly, we can set the `on.schedule` workflow trigger.
|
||||||
|
See [Scheduled events | Events that trigger workflows - GitHub Docs](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events)
|
||||||
|
|
||||||
|
For deploying manually, we can set the `on.workflow_dispatch` workflow trigger.
|
||||||
|
See [Manual events `workflow_dispatch` | Events that trigger workflows - GitHub Docs](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#manual-events)
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: github pages
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
schedule:
|
||||||
|
- cron: "22 22 * * *"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
steps:
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
<div align="right">
|
<div align="right">
|
||||||
<a href="#table-of-contents">Back to TOC ☝️</a>
|
<a href="#table-of-contents">Back to TOC ☝️</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -552,7 +602,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2.1.0
|
||||||
with:
|
with:
|
||||||
node-version: '12.x'
|
node-version: '12.x'
|
||||||
|
|
||||||
@@ -596,7 +646,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2.1.0
|
||||||
with:
|
with:
|
||||||
node-version: '12.x'
|
node-version: '12.x'
|
||||||
|
|
||||||
@@ -644,7 +694,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2.1.0
|
||||||
with:
|
with:
|
||||||
node-version: '12.x'
|
node-version: '12.x'
|
||||||
|
|
||||||
@@ -695,7 +745,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2.1.0
|
||||||
with:
|
with:
|
||||||
node-version: '12.x'
|
node-version: '12.x'
|
||||||
|
|
||||||
@@ -747,7 +797,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2.1.0
|
||||||
with:
|
with:
|
||||||
node-version: '12.x'
|
node-version: '12.x'
|
||||||
|
|
||||||
@@ -929,7 +979,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2.1.0
|
||||||
with:
|
with:
|
||||||
node-version: '12.x'
|
node-version: '12.x'
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,32 @@ describe('setGithubToken()', () => {
|
|||||||
expect(test).toMatch(expected);
|
expect(test).toMatch(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('return remote url with GITHUB_TOKEN gh-pages (RegExp)', () => {
|
||||||
|
const expected = 'https://x-access-token:GITHUB_TOKEN@github.com/owner/repo.git';
|
||||||
|
const test = setGithubToken(
|
||||||
|
'GITHUB_TOKEN',
|
||||||
|
'owner/repo',
|
||||||
|
'gh-pages',
|
||||||
|
'',
|
||||||
|
'refs/heads/gh-pages-base',
|
||||||
|
'push'
|
||||||
|
);
|
||||||
|
expect(test).toMatch(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('throw error gh-pages-base to gh-pages-base (RegExp)', () => {
|
||||||
|
expect(() => {
|
||||||
|
setGithubToken(
|
||||||
|
'GITHUB_TOKEN',
|
||||||
|
'owner/repo',
|
||||||
|
'gh-pages-base',
|
||||||
|
'',
|
||||||
|
'refs/heads/gh-pages-base',
|
||||||
|
'push'
|
||||||
|
);
|
||||||
|
}).toThrowError('You deploy from gh-pages-base to gh-pages-base');
|
||||||
|
});
|
||||||
|
|
||||||
test('throw error master to master', () => {
|
test('throw error master to master', () => {
|
||||||
expect(() => {
|
expect(() => {
|
||||||
setGithubToken('GITHUB_TOKEN', 'owner/repo', 'master', '', 'refs/heads/master', 'push');
|
setGithubToken('GITHUB_TOKEN', 'owner/repo', 'master', '', 'refs/heads/master', 'push');
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
1163
package-lock.json
generated
1163
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "actions-github-pages",
|
"name": "actions-github-pages",
|
||||||
"version": "3.6.2",
|
"version": "3.6.3",
|
||||||
"description": "GitHub Actions for GitHub Pages",
|
"description": "GitHub Actions for GitHub Pages",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
"js-yaml": "^3.14.0",
|
"js-yaml": "^3.14.0",
|
||||||
"lint-staged": "^10.2.11",
|
"lint-staged": "^10.2.11",
|
||||||
"prettier": "2.0.5",
|
"prettier": "2.0.5",
|
||||||
"standard-version": "^8.0.0",
|
"standard-version": "^8.0.1",
|
||||||
"ts-jest": "^25.5.1",
|
"ts-jest": "^25.5.1",
|
||||||
"typescript": "^3.9.6"
|
"typescript": "^3.9.6"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ Use deploy_key or personal_token.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (eventName === 'push') {
|
if (eventName === 'push') {
|
||||||
isProhibitedBranch = ref.includes(`refs/heads/${publishBranch}`);
|
isProhibitedBranch = ref.match(new RegExp(`^refs/heads/${publishBranch}$`)) !== null;
|
||||||
if (isProhibitedBranch) {
|
if (isProhibitedBranch) {
|
||||||
throw new Error(`You deploy from ${publishBranch} to ${publishBranch}`);
|
throw new Error(`You deploy from ${publishBranch} to ${publishBranch}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user