Compare commits

..

21 Commits

Author SHA1 Message Date
peaceiris
8457ade3d7 chore(release): 3.6.1
Some checks failed
Release / release (push) Has been cancelled
2020-05-04 10:29:34 +09:00
peaceiris
bdb15640ef chore(release): Add build assets 2020-05-04 10:29:33 +09:00
peaceiris
f559ed8889 docs: Add example image for commit_message 2020-05-04 10:27:29 +09:00
Shohei Ueda
db3e60d230 feat: Fold logs using core.startGroup() (#277)
cf. https://github.com/actions/toolkit/blob/master/docs/commands.md
2020-05-04 10:23:22 +09:00
Shohei Ueda
504181401b test: Add test case for getCommitMessage() (#276) 2020-05-04 10:06:41 +09:00
peaceiris
b0da6c009f chore(release): Remove build assets [skip ci] 2020-05-04 09:51:28 +09:00
peaceiris
c56c9818a0 chore(release): 3.6.0
Some checks failed
Release / release (push) Has been cancelled
2020-05-04 09:51:27 +09:00
peaceiris
1c794ced3b chore(release): Add build assets 2020-05-04 09:51:26 +09:00
Shohei Ueda
0b7411e2cf feat: Add full_commit_message (#275)
* feat: Add full_commit_message
* ci: Add full_commit_message
* docs: Add full_commit_message

cf. #274
2020-05-04 09:50:38 +09:00
peaceiris
750c807fa1 chore: Enhance style 2020-05-04 00:52:58 +09:00
dependabot-preview[bot]
ae34186caa deps: bump jest from 25.5.3 to 25.5.4 (#272) 2020-05-02 08:30:17 +00:00
dependabot-preview[bot]
a5d411bf28 deps: bump jest-circus from 25.5.3 to 25.5.4 (#271) 2020-05-02 08:23:58 +00:00
peaceiris
2875e4112a Revert "ci: use github_token"
This reverts commit 9d27fac8dc.
2020-05-02 02:25:23 +09:00
Shohei Ueda
9d27fac8dc ci: use github_token 2020-05-02 02:21:22 +09:00
Shohei Ueda
7501463241 ci: Add test-ubuntu-20.04 job (#270)
- Bumps mdBook from 0.3.6 to 0.3.7
- Add test job for ubuntu 20.04

cf. #268
2020-05-01 15:10:19 +09:00
dependabot-preview[bot]
b9cccec41e deps: bump lint-staged from 10.2.1 to 10.2.2 (#269) 2020-05-01 04:44:42 +00:00
dependabot-preview[bot]
e782e1d323 deps: bump jest from 25.5.2 to 25.5.3 (#267) 2020-04-30 22:48:48 +00:00
dependabot-preview[bot]
c12a4b1908 deps: bump jest-circus from 25.5.2 to 25.5.3 (#266) 2020-04-30 22:28:14 +00:00
dependabot-preview[bot]
dd1933a7b4 deps: bump @actions/core from 1.2.3 to 1.2.4 (#265) 2020-04-30 17:21:50 +00:00
dependabot-preview[bot]
08093066ac deps: bump lint-staged from 10.2.0 to 10.2.1 (#264) 2020-04-30 15:00:06 +00:00
peaceiris
c603e10bc1 chore(release): Remove build assets [skip ci] 2020-04-30 23:49:32 +09:00
17 changed files with 398 additions and 139 deletions

View File

@@ -6,26 +6,26 @@ labels: support
assignees: peaceiris
---
**Check list before opening this issue**
### Check list before opening this issue
- [ ] I read the latest README
- I checked [Available Options](https://github.com/peaceiris/actions-gh-pages#options)
- I followed [Tips and FAQ](https://github.com/peaceiris/actions-gh-pages#tips-and-faq)
- I tried [Workflow Examples](https://github.com/peaceiris/actions-gh-pages#examples)
**Describe your question**
### Describe your question
A clear and concise description of what the question is.
**Link to your contents**
### Link to your contents
- Link to your public repository here
- Link to your workflow here
**Screenshots**
### Screenshots
If applicable, add screenshots to help explain your question.
**Additional context**
### Additional context
Add any other context about the problem here.

View File

@@ -7,25 +7,31 @@ assignees: peaceiris
---
**Describe the bug**
### Describe the bug
A clear and concise description of what the bug is.
**To Reproduce**
### To Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
### Expected behavior
A clear and concise description of what you expected to happen.
**Screenshots**
### Screenshots
If applicable, add screenshots to help explain your problem.
**Your YAML file**
### Your YAML file
- A link to your repository
- A link to your YAML file
**Additional context**
### Additional context
Add any other context about the problem here.

View File

@@ -7,14 +7,18 @@ assignees: peaceiris
---
**Is your feature request related to a problem? Please describe.**
### Is your feature request related to a problem? Please describe
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
### Describe the solution you'd like
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
### Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
### Additional context
Add any other context or screenshots about the feature request here.

View File

@@ -89,7 +89,7 @@ jobs:
if: github.ref == 'refs/heads/master'
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: '0.3.6'
mdbook-version: '0.3.7'
- name: Build site
if: github.ref == 'refs/heads/master'
@@ -131,7 +131,7 @@ jobs:
force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
# commit_message: ${{ github.event.head_commit.message }}
full_commit_message: ${{ github.event.head_commit.message }}
- name: Deploy
if: |
@@ -170,3 +170,82 @@ jobs:
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
# commit_message: ${{ github.event.head_commit.message }}
test-ubuntu-2004:
runs-on: 'ubuntu-18.04'
if: contains(github.event.head_commit.message, '[skip ci]') == false
container:
image: 'ubuntu:20.04'
steps:
- name: Install deps
run: |
apt update
apt install -y software-properties-common
add-apt-repository ppa:git-core/ppa
apt update
apt install -y \
git \
ssh
- uses: actions/checkout@v2
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "${GITHUB_CONTEXT}"
- name: Read .nvmrc
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
id: nvm
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- run: npm i -g npm
- name: Dump version
run: |
node -v
npm --version
git --version
- run: npm ci
- run: npm test
- name: Run ncc
run: npm run build
- name: Remove lint-staged husky
if: github.ref == 'refs/heads/master'
run: |
npm uninstall lint-staged husky
git checkout package-lock.json package.json
- name: Setup mdBook
if: github.ref == 'refs/heads/master'
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: '0.3.7'
- name: Build site
if: github.ref == 'refs/heads/master'
working-directory: ./test_projects/mdbook
run: mdbook build
- name: Deploy
if: github.ref == 'refs/heads/master'
uses: ./
with:
# deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages-ubuntu-20.04
publish_dir: ./test_projects/mdbook/book
# external_repository: ''
allow_empty_commit: true
# keep_files: true
# force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
# commit_message: ${{ github.event.head_commit.message }}

View File

@@ -2,6 +2,51 @@
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.1](https://github.com/peaceiris/actions-gh-pages/compare/v3.6.0...v3.6.1) (2020-05-04)
### docs
* Add example image for commit_message ([f559ed8](https://github.com/peaceiris/actions-gh-pages/commit/f559ed8889a7ba2364757bc7a97b0491263147ff))
### feat
* Fold logs using core.startGroup() (#277) ([db3e60d](https://github.com/peaceiris/actions-gh-pages/commit/db3e60d230c7ebcd5342990f0ffc5af0ed1f4296)), closes [#277](https://github.com/peaceiris/actions-gh-pages/issues/277)
### test
* Add test case for getCommitMessage() (#276) ([5041814](https://github.com/peaceiris/actions-gh-pages/commit/504181401bb2df2de020ed72a7f2b4f8942bcb77)), closes [#276](https://github.com/peaceiris/actions-gh-pages/issues/276)
# [3.6.0](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.10...v3.6.0) (2020-05-04)
### chore
* Enhance style ([750c807](https://github.com/peaceiris/actions-gh-pages/commit/750c807fa1ecf9d3d455cfd0fb5533442c660a1e))
### ci
* Add test-ubuntu-20.04 job (#270) ([7501463](https://github.com/peaceiris/actions-gh-pages/commit/75014632413b319cb87db5b3e54bba2d6a21ac05)), closes [#270](https://github.com/peaceiris/actions-gh-pages/issues/270) [#268](https://github.com/peaceiris/actions-gh-pages/issues/268)
* use github_token ([9d27fac](https://github.com/peaceiris/actions-gh-pages/commit/9d27fac8dcdc50937d59b3068c59acf257ad2398))
### deps
* bump @actions/core from 1.2.3 to 1.2.4 (#265) ([dd1933a](https://github.com/peaceiris/actions-gh-pages/commit/dd1933a7b4b77a06b1995b0e8c40b6c219f32550)), closes [#265](https://github.com/peaceiris/actions-gh-pages/issues/265)
* bump jest from 25.5.2 to 25.5.3 (#267) ([e782e1d](https://github.com/peaceiris/actions-gh-pages/commit/e782e1d32332c2e99058a039dd5caaf0533d0af6)), closes [#267](https://github.com/peaceiris/actions-gh-pages/issues/267)
* bump jest from 25.5.3 to 25.5.4 (#272) ([ae34186](https://github.com/peaceiris/actions-gh-pages/commit/ae34186caa187c2960bae6d656f6ef69c6aa0fba)), closes [#272](https://github.com/peaceiris/actions-gh-pages/issues/272)
* bump jest-circus from 25.5.2 to 25.5.3 (#266) ([c12a4b1](https://github.com/peaceiris/actions-gh-pages/commit/c12a4b1908457ab10af84e0947b66af3f868790c)), closes [#266](https://github.com/peaceiris/actions-gh-pages/issues/266)
* bump jest-circus from 25.5.3 to 25.5.4 (#271) ([a5d411b](https://github.com/peaceiris/actions-gh-pages/commit/a5d411bf285983883daecb16787a8f6549da66d8)), closes [#271](https://github.com/peaceiris/actions-gh-pages/issues/271)
* bump lint-staged from 10.2.0 to 10.2.1 (#264) ([0809306](https://github.com/peaceiris/actions-gh-pages/commit/08093066ac77639e402a4b60492a7759c395ba36)), closes [#264](https://github.com/peaceiris/actions-gh-pages/issues/264)
* bump lint-staged from 10.2.1 to 10.2.2 (#269) ([b9cccec](https://github.com/peaceiris/actions-gh-pages/commit/b9cccec41e2e47ef704d34a7409dc07a50e32d46)), closes [#269](https://github.com/peaceiris/actions-gh-pages/issues/269)
### feat
* Add full_commit_message (#275) ([0b7411e](https://github.com/peaceiris/actions-gh-pages/commit/0b7411e2cf05b033f6766798560d02e932e01bd2)), closes [#275](https://github.com/peaceiris/actions-gh-pages/issues/275) [#274](https://github.com/peaceiris/actions-gh-pages/issues/274)
## [3.5.10](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.9...v3.5.10) (2020-04-30)

View File

@@ -385,7 +385,7 @@ A commit is always created with the same user.
### ⭐️ Set custom commit message
Set custom commit message.
Set a custom commit message.
When we create a commit with a message `docs: Update some post`, a deployment commit will be generated with a message `docs: Update some post ${GITHUB_SHA}`.
```yaml
@@ -397,6 +397,20 @@ When we create a commit with a message `docs: Update some post`, a deployment co
commit_message: ${{ github.event.head_commit.message }}
```
![Set a custom commit message - GitHub Actions for GitHub Pages](./images/commit_message.jpg)
To set a full custom commit message without a triggered commit hash,
use the `full_commit_message` option instead of the `commit_message` option.
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
full_commit_message: ${{ github.event.head_commit.message }}
```
### ⭐️ Create Git tag
Here is an example workflow.

View File

@@ -51,6 +51,7 @@ function getInputsLog(authMethod: string, inps: Inputs): string {
[INFO] UserName: ${inps.UserName}
[INFO] UserEmail: ${inps.UserEmail}
[INFO] CommitMessage: ${inps.CommitMessage}
[INFO] FullCommitMessage: ${inps.FullCommitMessage}
[INFO] TagName: ${inps.TagName}
[INFO] TagMessage: ${inps.TagMessage}
[INFO] EnableJekyll (DisableNoJekyll): ${inps.DisableNoJekyll}
@@ -117,6 +118,7 @@ describe('getInputs()', () => {
expect(inps.UserName).toMatch('');
expect(inps.UserEmail).toMatch('');
expect(inps.CommitMessage).toMatch('');
expect(inps.FullCommitMessage).toMatch('');
expect(inps.TagName).toMatch('');
expect(inps.TagMessage).toMatch('');
expect(inps.DisableNoJekyll).toBe(false);
@@ -136,6 +138,7 @@ describe('getInputs()', () => {
process.env['INPUT_USER_NAME'] = 'username';
process.env['INPUT_USER_EMAIL'] = 'github@github.com';
process.env['INPUT_COMMIT_MESSAGE'] = 'feat: Add new feature';
process.env['INPUT_FULL_COMMIT_MESSAGE'] = 'feat: Add new feature';
process.env['INPUT_TAG_NAME'] = 'deploy-v1.2.3';
process.env['INPUT_TAG_MESSAGE'] = 'Deployment v1.2.3';
process.env['INPUT_DISABLE_NOJEKYLL'] = 'true';
@@ -155,12 +158,19 @@ describe('getInputs()', () => {
expect(inps.UserName).toMatch('username');
expect(inps.UserEmail).toMatch('github@github.com');
expect(inps.CommitMessage).toMatch('feat: Add new feature');
expect(inps.FullCommitMessage).toMatch('feat: Add new feature');
expect(inps.TagName).toMatch('deploy-v1.2.3');
expect(inps.TagMessage).toMatch('Deployment v1.2.3');
expect(inps.DisableNoJekyll).toBe(true);
expect(inps.CNAME).toMatch('github.com');
});
test('get spec inputs enable_jekyll', () => {
process.env['INPUT_ENABLE_JEKYLL'] = 'true';
const inps: Inputs = getInputs();
expect(inps.DisableNoJekyll).toBe(true);
});
test('throw error enable_jekyll or disable_nojekyll', () => {
process.env['INPUT_DEPLOY_KEY'] = 'test_deploy_key';
process.env['INPUT_ENABLE_JEKYLL'] = 'true';

View File

@@ -1,4 +1,9 @@
import {getUserName, getUserEmail, setCommitAuthor} from '../src/git-utils';
import {
getUserName,
getUserEmail,
setCommitAuthor,
getCommitMessage
} from '../src/git-utils';
import {getWorkDirName, createWorkDir} from '../src/utils';
import {CmdResult} from '../src/interfaces';
import * as exec from '@actions/exec';
@@ -114,3 +119,65 @@ describe('setCommitAuthor()', () => {
);
});
});
describe('getCommitMessage()', () => {
test('get default message', () => {
const test = getCommitMessage('', '', '', 'actions/pages', 'commit_hash');
expect(test).toMatch('deploy: commit_hash');
});
test('get default message for external repository', () => {
const test = getCommitMessage(
'',
'',
'actions/actions.github.io',
'actions/pages',
'commit_hash'
);
expect(test).toMatch('deploy: actions/pages@commit_hash');
});
test('get custom message', () => {
const test = getCommitMessage(
'Custom msg',
'',
'',
'actions/pages',
'commit_hash'
);
expect(test).toMatch('Custom msg commit_hash');
});
test('get custom message for external repository', () => {
const test = getCommitMessage(
'Custom msg',
'',
'actions/actions.github.io',
'actions/pages',
'commit_hash'
);
expect(test).toMatch('Custom msg actions/pages@commit_hash');
});
test('get full custom message', () => {
const test = getCommitMessage(
'',
'Full custom msg',
'',
'actions/pages',
'commit_hash'
);
expect(test).toMatch('Full custom msg');
});
test('get full custom message for external repository', () => {
const test = getCommitMessage(
'',
'Full custom msg',
'actions/actions.github.io',
'actions/pages',
'commit_hash'
);
expect(test).toMatch('Full custom msg');
});
});

View File

@@ -47,7 +47,10 @@ inputs:
description: 'Set Git user.email'
required: false
commit_message:
description: 'Set custom commit message'
description: 'Set a custom commit message with a triggered commit hash'
required: false
full_commit_message:
description: 'Set a custom full commit message without a triggered commit hash'
required: false
tag_name:
description: 'Set tag name'

BIN
images/commit_message.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

File diff suppressed because one or more lines are too long

169
package-lock.json generated
View File

@@ -1,13 +1,13 @@
{
"name": "actions-github-pages",
"version": "3.5.10",
"version": "3.6.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@actions/core": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.3.tgz",
"integrity": "sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w=="
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz",
"integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg=="
},
"@actions/exec": {
"version": "1.0.4",
@@ -439,9 +439,9 @@
}
},
"@jest/core": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/@jest/core/-/core-25.5.2.tgz",
"integrity": "sha512-vc7WqwPbFX22EWDbuxJDnWDh5YYyReimgxKO/DYA1wMJd7/PcbUwM4PY7xadRZ2ze8Wi3OtmXP8ZbJEfcWY5Xg==",
"version": "25.5.4",
"resolved": "https://registry.npmjs.org/@jest/core/-/core-25.5.4.tgz",
"integrity": "sha512-3uSo7laYxF00Dg/DMgbn4xMJKmDdWvZnf89n8Xj/5/AeQ2dOQmn6b6Hkj/MleyzZWXpwv+WSdYWl4cLsy2JsoA==",
"dev": true,
"requires": {
"@jest/console": "^25.5.0",
@@ -454,14 +454,14 @@
"exit": "^0.1.2",
"graceful-fs": "^4.2.4",
"jest-changed-files": "^25.5.0",
"jest-config": "^25.5.2",
"jest-config": "^25.5.4",
"jest-haste-map": "^25.5.1",
"jest-message-util": "^25.5.0",
"jest-regex-util": "^25.2.6",
"jest-resolve": "^25.5.1",
"jest-resolve-dependencies": "^25.5.2",
"jest-runner": "^25.5.2",
"jest-runtime": "^25.5.2",
"jest-resolve-dependencies": "^25.5.4",
"jest-runner": "^25.5.4",
"jest-runtime": "^25.5.4",
"jest-snapshot": "^25.5.1",
"jest-util": "^25.5.0",
"jest-validate": "^25.5.0",
@@ -723,16 +723,16 @@
}
},
"@jest/test-sequencer": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-25.5.2.tgz",
"integrity": "sha512-spQjGJ+QTjqB2NcZclkEpStF4uXxfpMfGAsW12dtxfjR9nsxTyTEYt8JUtrpxfYk8R1iTbcwkayekxZPB2MEiw==",
"version": "25.5.4",
"resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-25.5.4.tgz",
"integrity": "sha512-pTJGEkSeg1EkCO2YWq6hbFvKNXk8ejqlxiOg1jBNLnWrgXOkdY6UmqZpwGFXNnRt9B8nO1uWMzLLZ4eCmhkPNA==",
"dev": true,
"requires": {
"@jest/test-result": "^25.5.0",
"graceful-fs": "^4.2.4",
"jest-haste-map": "^25.5.1",
"jest-runner": "^25.5.2",
"jest-runtime": "^25.5.2"
"jest-runner": "^25.5.4",
"jest-runtime": "^25.5.4"
},
"dependencies": {
"graceful-fs": {
@@ -4196,14 +4196,14 @@
}
},
"jest": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/jest/-/jest-25.5.2.tgz",
"integrity": "sha512-uJwrQNpNwhlP4SX3lpvjc5ucOULeWUCQCfrREqvQW5phAy04q5lQPsGM6Z0T1Psdnuf9CkycpoNEL6O3FMGcsg==",
"version": "25.5.4",
"resolved": "https://registry.npmjs.org/jest/-/jest-25.5.4.tgz",
"integrity": "sha512-hHFJROBTqZahnO+X+PMtT6G2/ztqAZJveGqz//FnWWHurizkD05PQGzRZOhF3XP6z7SJmL+5tCfW8qV06JypwQ==",
"dev": true,
"requires": {
"@jest/core": "^25.5.2",
"@jest/core": "^25.5.4",
"import-local": "^3.0.2",
"jest-cli": "^25.5.2"
"jest-cli": "^25.5.4"
},
"dependencies": {
"@jest/types": {
@@ -4225,12 +4225,12 @@
"dev": true
},
"jest-cli": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-25.5.2.tgz",
"integrity": "sha512-jbOJ4oOIJptg5mjNQZWyHkv33sXCIFT2UnkYwlZvyVU/0nz5nmIlIx57iTgHkmeRBp1VkK2qPZhjCDwHmxNKgA==",
"version": "25.5.4",
"resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-25.5.4.tgz",
"integrity": "sha512-rG8uJkIiOUpnREh1768/N3n27Cm+xPFkSNFO91tgg+8o2rXeVLStz+vkXkGr4UtzH6t1SNbjwoiswd7p4AhHTw==",
"dev": true,
"requires": {
"@jest/core": "^25.5.2",
"@jest/core": "^25.5.4",
"@jest/test-result": "^25.5.0",
"@jest/types": "^25.5.0",
"chalk": "^3.0.0",
@@ -4238,7 +4238,7 @@
"graceful-fs": "^4.2.4",
"import-local": "^3.0.2",
"is-ci": "^2.0.0",
"jest-config": "^25.5.2",
"jest-config": "^25.5.4",
"jest-util": "^25.5.0",
"jest-validate": "^25.5.0",
"prompts": "^2.0.1",
@@ -4363,9 +4363,9 @@
}
},
"jest-circus": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-25.5.2.tgz",
"integrity": "sha512-sSgIy+Jkdhx/2VMHOZNQDhRMPWG3MXk8scqsAM9LgK7prYdPvp8x3HYlsjB50dv2sRNItKbngYXP3/xsCNp0QA==",
"version": "25.5.4",
"resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-25.5.4.tgz",
"integrity": "sha512-nOLJXZjWuV2i8yQ2w+MZ8NhFuqrbgpPAa4mh+DWPYmNI377YYpDKvDUrLMW8U1sa2iGt5mjKQbmJz2SK9AYjWg==",
"dev": true,
"requires": {
"@babel/traverse": "^7.1.0",
@@ -4379,7 +4379,7 @@
"jest-each": "^25.5.0",
"jest-matcher-utils": "^25.5.0",
"jest-message-util": "^25.5.0",
"jest-runtime": "^25.5.2",
"jest-runtime": "^25.5.4",
"jest-snapshot": "^25.5.1",
"jest-util": "^25.5.0",
"pretty-format": "^25.5.0",
@@ -4387,28 +4387,17 @@
"throat": "^5.0.0"
},
"dependencies": {
"@jest/globals": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/@jest/globals/-/globals-25.5.2.tgz",
"integrity": "sha512-AgAS/Ny7Q2RCIj5kZ+0MuKM1wbF0WMLxbCVl/GOMoCNbODRdJ541IxJ98xnZdVSZXivKpJlNPIWa3QmY0l4CXA==",
"dev": true,
"requires": {
"@jest/environment": "^25.5.0",
"@jest/types": "^25.5.0",
"expect": "^25.5.0"
}
},
"@jest/test-sequencer": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-25.5.2.tgz",
"integrity": "sha512-spQjGJ+QTjqB2NcZclkEpStF4uXxfpMfGAsW12dtxfjR9nsxTyTEYt8JUtrpxfYk8R1iTbcwkayekxZPB2MEiw==",
"version": "25.5.4",
"resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-25.5.4.tgz",
"integrity": "sha512-pTJGEkSeg1EkCO2YWq6hbFvKNXk8ejqlxiOg1jBNLnWrgXOkdY6UmqZpwGFXNnRt9B8nO1uWMzLLZ4eCmhkPNA==",
"dev": true,
"requires": {
"@jest/test-result": "^25.5.0",
"graceful-fs": "^4.2.4",
"jest-haste-map": "^25.5.1",
"jest-runner": "^25.5.2",
"jest-runtime": "^25.5.2"
"jest-runner": "^25.5.4",
"jest-runtime": "^25.5.4"
}
},
"@jest/types": {
@@ -4430,13 +4419,13 @@
"dev": true
},
"jest-config": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/jest-config/-/jest-config-25.5.2.tgz",
"integrity": "sha512-6KVTvhJYyXQVFMDxMCxqf9IgdI0dhdaIKR9WN9U+w3xcvNEWCgwzK5LaSx6hvthgh/sukJb3bC4jMnIUXkWu+A==",
"version": "25.5.4",
"resolved": "https://registry.npmjs.org/jest-config/-/jest-config-25.5.4.tgz",
"integrity": "sha512-SZwR91SwcdK6bz7Gco8qL7YY2sx8tFJYzvg216DLihTWf+LKY/DoJXpM9nTzYakSyfblbqeU48p/p7Jzy05Atg==",
"dev": true,
"requires": {
"@babel/core": "^7.1.0",
"@jest/test-sequencer": "^25.5.2",
"@jest/test-sequencer": "^25.5.4",
"@jest/types": "^25.5.0",
"babel-jest": "^25.5.1",
"chalk": "^3.0.0",
@@ -4446,7 +4435,7 @@
"jest-environment-jsdom": "^25.5.0",
"jest-environment-node": "^25.5.0",
"jest-get-type": "^25.2.6",
"jest-jasmine2": "^25.5.2",
"jest-jasmine2": "^25.5.4",
"jest-regex-util": "^25.2.6",
"jest-resolve": "^25.5.1",
"jest-util": "^25.5.0",
@@ -4457,9 +4446,9 @@
}
},
"jest-jasmine2": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-25.5.2.tgz",
"integrity": "sha512-wRtHAy97F4hafJgnh5CwI/N1tDo7z+urteQAyr3rjK7X3TZWX5hSV4cO7WIBKLDV0kPICCmsGiNYs1caeHD/sQ==",
"version": "25.5.4",
"resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-25.5.4.tgz",
"integrity": "sha512-9acbWEfbmS8UpdcfqnDO+uBUgKa/9hcRh983IHdM+pKmJPL77G0sWAAK0V0kr5LK3a8cSBfkFSoncXwQlRZfkQ==",
"dev": true,
"requires": {
"@babel/traverse": "^7.1.0",
@@ -4474,7 +4463,7 @@
"jest-each": "^25.5.0",
"jest-matcher-utils": "^25.5.0",
"jest-message-util": "^25.5.0",
"jest-runtime": "^25.5.2",
"jest-runtime": "^25.5.4",
"jest-snapshot": "^25.5.1",
"jest-util": "^25.5.0",
"pretty-format": "^25.5.0",
@@ -4482,9 +4471,9 @@
}
},
"jest-runner": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-25.5.2.tgz",
"integrity": "sha512-GvaM0AWSfyer46BEranPSmKoNNW9RqLGnjKftE6I5Ia6cfjdHHeTHAus7Mh9PdjWzGqrXsLSGdErX+4wMvN3rQ==",
"version": "25.5.4",
"resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-25.5.4.tgz",
"integrity": "sha512-V/2R7fKZo6blP8E9BL9vJ8aTU4TH2beuqGNxHbxi6t14XzTb+x90B3FRgdvuHm41GY8ch4xxvf0ATH4hdpjTqg==",
"dev": true,
"requires": {
"@jest/console": "^25.5.0",
@@ -4494,14 +4483,14 @@
"chalk": "^3.0.0",
"exit": "^0.1.2",
"graceful-fs": "^4.2.4",
"jest-config": "^25.5.2",
"jest-config": "^25.5.4",
"jest-docblock": "^25.3.0",
"jest-haste-map": "^25.5.1",
"jest-jasmine2": "^25.5.2",
"jest-jasmine2": "^25.5.4",
"jest-leak-detector": "^25.5.0",
"jest-message-util": "^25.5.0",
"jest-resolve": "^25.5.1",
"jest-runtime": "^25.5.2",
"jest-runtime": "^25.5.4",
"jest-util": "^25.5.0",
"jest-worker": "^25.5.0",
"source-map-support": "^0.5.6",
@@ -4509,9 +4498,9 @@
}
},
"jest-runtime": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-25.5.2.tgz",
"integrity": "sha512-UQTPBnE73qpGMKAXYB2agoC+6hMyT3dWXVL+cYibCFRm0tx2A+0+8wceoivRCtxQGaQr52c+qMRIOIRqmhAgHQ==",
"version": "25.5.4",
"resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-25.5.4.tgz",
"integrity": "sha512-RWTt8LeWh3GvjYtASH2eezkc8AehVoWKK20udV6n3/gC87wlTbE1kIA+opCvNWyyPeBs6ptYsc6nyHUb1GlUVQ==",
"dev": true,
"requires": {
"@jest/console": "^25.5.0",
@@ -4527,7 +4516,7 @@
"exit": "^0.1.2",
"glob": "^7.1.3",
"graceful-fs": "^4.2.4",
"jest-config": "^25.5.2",
"jest-config": "^25.5.4",
"jest-haste-map": "^25.5.1",
"jest-message-util": "^25.5.0",
"jest-mock": "^25.5.0",
@@ -4557,13 +4546,13 @@
}
},
"jest-config": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/jest-config/-/jest-config-25.5.2.tgz",
"integrity": "sha512-6KVTvhJYyXQVFMDxMCxqf9IgdI0dhdaIKR9WN9U+w3xcvNEWCgwzK5LaSx6hvthgh/sukJb3bC4jMnIUXkWu+A==",
"version": "25.5.4",
"resolved": "https://registry.npmjs.org/jest-config/-/jest-config-25.5.4.tgz",
"integrity": "sha512-SZwR91SwcdK6bz7Gco8qL7YY2sx8tFJYzvg216DLihTWf+LKY/DoJXpM9nTzYakSyfblbqeU48p/p7Jzy05Atg==",
"dev": true,
"requires": {
"@babel/core": "^7.1.0",
"@jest/test-sequencer": "^25.5.2",
"@jest/test-sequencer": "^25.5.4",
"@jest/types": "^25.5.0",
"babel-jest": "^25.5.1",
"chalk": "^3.0.0",
@@ -4573,7 +4562,7 @@
"jest-environment-jsdom": "^25.5.0",
"jest-environment-node": "^25.5.0",
"jest-get-type": "^25.2.6",
"jest-jasmine2": "^25.5.2",
"jest-jasmine2": "^25.5.4",
"jest-regex-util": "^25.2.6",
"jest-resolve": "^25.5.1",
"jest-util": "^25.5.0",
@@ -4851,9 +4840,9 @@
}
},
"jest-jasmine2": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-25.5.2.tgz",
"integrity": "sha512-wRtHAy97F4hafJgnh5CwI/N1tDo7z+urteQAyr3rjK7X3TZWX5hSV4cO7WIBKLDV0kPICCmsGiNYs1caeHD/sQ==",
"version": "25.5.4",
"resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-25.5.4.tgz",
"integrity": "sha512-9acbWEfbmS8UpdcfqnDO+uBUgKa/9hcRh983IHdM+pKmJPL77G0sWAAK0V0kr5LK3a8cSBfkFSoncXwQlRZfkQ==",
"dev": true,
"requires": {
"@babel/traverse": "^7.1.0",
@@ -4868,7 +4857,7 @@
"jest-each": "^25.5.0",
"jest-matcher-utils": "^25.5.0",
"jest-message-util": "^25.5.0",
"jest-runtime": "^25.5.2",
"jest-runtime": "^25.5.4",
"jest-snapshot": "^25.5.1",
"jest-util": "^25.5.0",
"pretty-format": "^25.5.0",
@@ -5136,9 +5125,9 @@
}
},
"jest-resolve-dependencies": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-25.5.2.tgz",
"integrity": "sha512-4xlPp6/SFFZj7g7WkhoKEEWsYqmAK6WcmFFRfDJ0K4T2f/MCJgFEPqv1F88ro6ZJdpOti08CxGku4gBwau/RjQ==",
"version": "25.5.4",
"resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-25.5.4.tgz",
"integrity": "sha512-yFmbPd+DAQjJQg88HveObcGBA32nqNZ02fjYmtL16t1xw9bAttSn5UGRRhzMHIQbsep7znWvAvnD4kDqOFM0Uw==",
"dev": true,
"requires": {
"@jest/types": "^25.5.0",
@@ -5161,9 +5150,9 @@
}
},
"jest-runner": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-25.5.2.tgz",
"integrity": "sha512-GvaM0AWSfyer46BEranPSmKoNNW9RqLGnjKftE6I5Ia6cfjdHHeTHAus7Mh9PdjWzGqrXsLSGdErX+4wMvN3rQ==",
"version": "25.5.4",
"resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-25.5.4.tgz",
"integrity": "sha512-V/2R7fKZo6blP8E9BL9vJ8aTU4TH2beuqGNxHbxi6t14XzTb+x90B3FRgdvuHm41GY8ch4xxvf0ATH4hdpjTqg==",
"dev": true,
"requires": {
"@jest/console": "^25.5.0",
@@ -5173,14 +5162,14 @@
"chalk": "^3.0.0",
"exit": "^0.1.2",
"graceful-fs": "^4.2.4",
"jest-config": "^25.5.2",
"jest-config": "^25.5.4",
"jest-docblock": "^25.3.0",
"jest-haste-map": "^25.5.1",
"jest-jasmine2": "^25.5.2",
"jest-jasmine2": "^25.5.4",
"jest-leak-detector": "^25.5.0",
"jest-message-util": "^25.5.0",
"jest-resolve": "^25.5.1",
"jest-runtime": "^25.5.2",
"jest-runtime": "^25.5.4",
"jest-util": "^25.5.0",
"jest-worker": "^25.5.0",
"source-map-support": "^0.5.6",
@@ -5208,9 +5197,9 @@
}
},
"jest-runtime": {
"version": "25.5.2",
"resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-25.5.2.tgz",
"integrity": "sha512-UQTPBnE73qpGMKAXYB2agoC+6hMyT3dWXVL+cYibCFRm0tx2A+0+8wceoivRCtxQGaQr52c+qMRIOIRqmhAgHQ==",
"version": "25.5.4",
"resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-25.5.4.tgz",
"integrity": "sha512-RWTt8LeWh3GvjYtASH2eezkc8AehVoWKK20udV6n3/gC87wlTbE1kIA+opCvNWyyPeBs6ptYsc6nyHUb1GlUVQ==",
"dev": true,
"requires": {
"@jest/console": "^25.5.0",
@@ -5226,7 +5215,7 @@
"exit": "^0.1.2",
"glob": "^7.1.3",
"graceful-fs": "^4.2.4",
"jest-config": "^25.5.2",
"jest-config": "^25.5.4",
"jest-haste-map": "^25.5.1",
"jest-message-util": "^25.5.0",
"jest-mock": "^25.5.0",
@@ -5624,9 +5613,9 @@
"dev": true
},
"lint-staged": {
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-10.2.0.tgz",
"integrity": "sha512-4Dw2XMtEOGpICl0wvicE5KT/eFlt/kmwMmpNS4v09I/ywRWuR5udbMWjdfZez24jE6r0bQmPpkLZ1+wUGE1S+w==",
"version": "10.2.2",
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-10.2.2.tgz",
"integrity": "sha512-78kNqNdDeKrnqWsexAmkOU3Z5wi+1CsQmUmfCuYgMTE8E4rAIX8RHW7xgxwAZ+LAayb7Cca4uYX4P3LlevzjVg==",
"dev": true,
"requires": {
"chalk": "^4.0.0",

View File

@@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.5.10",
"version": "3.6.1",
"description": "GitHub Actions for GitHub Pages",
"main": "lib/index.js",
"engines": {
@@ -54,7 +54,7 @@
},
"homepage": "https://github.com/peaceiris/actions-gh-pages#readme",
"dependencies": {
"@actions/core": "^1.2.3",
"@actions/core": "^1.2.4",
"@actions/exec": "^1.0.4",
"@actions/github": "^2.1.1",
"@actions/io": "^1.0.2"
@@ -69,10 +69,10 @@
"eslint": "^6.8.0",
"eslint-plugin-jest": "^23.8.2",
"husky": "^4.2.5",
"jest": "^25.5.2",
"jest-circus": "^25.5.2",
"jest": "^25.5.4",
"jest-circus": "^25.5.4",
"js-yaml": "^3.13.1",
"lint-staged": "^10.2.0",
"lint-staged": "^10.2.2",
"prettier": "2.0.5",
"standard-version": "^7.1.0",
"ts-jest": "^25.4.0",

View File

@@ -22,6 +22,7 @@ export function showInputs(inps: Inputs): void {
[INFO] UserName: ${inps.UserName}
[INFO] UserEmail: ${inps.UserEmail}
[INFO] CommitMessage: ${inps.CommitMessage}
[INFO] FullCommitMessage: ${inps.FullCommitMessage}
[INFO] TagName: ${inps.TagName}
[INFO] TagMessage: ${inps.TagMessage}
[INFO] EnableJekyll (DisableNoJekyll): ${inps.DisableNoJekyll}
@@ -61,6 +62,7 @@ export function getInputs(): Inputs {
UserName: core.getInput('user_name'),
UserEmail: core.getInput('user_email'),
CommitMessage: core.getInput('commit_message'),
FullCommitMessage: core.getInput('full_commit_message'),
TagName: core.getInput('tag_name'),
TagMessage: core.getInput('tag_message'),
DisableNoJekyll: useBuiltinJekyll,

View File

@@ -1,6 +1,5 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as github from '@actions/github';
import * as io from '@actions/io';
import path from 'path';
import fs from 'fs';
@@ -133,26 +132,38 @@ export async function setCommitAuthor(
await exec.exec('git', ['config', 'user.email', getUserEmail(userEmail)]);
}
export function getCommitMessage(
msg: string,
fullMsg: string,
extRepo: string,
baseRepo: string,
hash: string
): string {
const msgHash = ((): string => {
if (extRepo) {
return `${baseRepo}@${hash}`;
} else {
return hash;
}
})();
const subject = ((): string => {
if (fullMsg) {
return fullMsg;
} else if (msg) {
return `${msg} ${msgHash}`;
} else {
return `deploy: ${msgHash}`;
}
})();
return subject;
}
export async function commit(
allowEmptyCommit: boolean,
externalRepository: string,
message: string
msg: string
): Promise<void> {
let msg = '';
if (message) {
msg = message;
} else {
msg = 'deploy:';
}
const hash = `${process.env.GITHUB_SHA}`;
const baseRepo = `${github.context.repo.owner}/${github.context.repo.repo}`;
if (externalRepository) {
msg = `${msg} ${baseRepo}@${hash}`;
} else {
msg = `${msg} ${hash}`;
}
try {
if (allowEmptyCommit) {
await exec.exec('git', ['commit', '--allow-empty', '-m', `${msg}`]);

View File

@@ -11,6 +11,7 @@ export interface Inputs {
readonly UserName: string;
readonly UserEmail: string;
readonly CommitMessage: string;
readonly FullCommitMessage: string;
readonly TagName: string;
readonly TagMessage: string;
readonly DisableNoJekyll: boolean;

View File

@@ -1,19 +1,31 @@
import {context} from '@actions/github';
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as github from '@actions/github';
import {Inputs} from './interfaces';
import {showInputs, getInputs} from './get-inputs';
import {setTokens} from './set-tokens';
import {setRepo, setCommitAuthor, commit, push, pushTag} from './git-utils';
import {
setRepo,
setCommitAuthor,
getCommitMessage,
commit,
push,
pushTag
} from './git-utils';
import {getWorkDirName, addNoJekyll, addCNAME, skipOnFork} from './utils';
export async function run(): Promise<void> {
try {
const inps: Inputs = getInputs();
core.startGroup('Dump inputs');
showInputs(inps);
core.endGroup();
if (core.isDebug()) {
core.startGroup('Debug: dump context');
console.log(context);
core.endGroup();
}
const eventName = context.eventName;
@@ -35,17 +47,21 @@ export async function run(): Promise<void> {
}
}
core.startGroup('Setup auth token');
const remoteURL = await setTokens(inps);
core.debug(`remoteURL: ${remoteURL}`);
core.endGroup();
core.startGroup('Prepare publishing assets');
const date = new Date();
const unixTime = date.getTime();
const workDir = await getWorkDirName(`${unixTime}`);
await setRepo(inps, remoteURL, workDir);
await addNoJekyll(workDir, inps.DisableNoJekyll, inps.PublishBranch);
await addCNAME(workDir, inps.CNAME);
core.endGroup();
core.startGroup('Setup Git config');
try {
await exec.exec('git', ['remote', 'rm', 'origin']);
} catch (e) {
@@ -54,13 +70,25 @@ export async function run(): Promise<void> {
await exec.exec('git', ['remote', 'add', 'origin', remoteURL]);
await exec.exec('git', ['add', '--all']);
await setCommitAuthor(inps.UserName, inps.UserEmail);
await commit(
inps.AllowEmptyCommit,
core.endGroup();
core.startGroup('Create a commit');
const hash = `${process.env.GITHUB_SHA}`;
const baseRepo = `${github.context.repo.owner}/${github.context.repo.repo}`;
const commitMessage = getCommitMessage(
inps.CommitMessage,
inps.FullCommitMessage,
inps.ExternalRepository,
inps.CommitMessage
baseRepo,
hash
);
await commit(inps.AllowEmptyCommit, commitMessage);
core.endGroup();
core.startGroup('Push the commit or tag');
await push(inps.PublishBranch, inps.ForceOrphan);
await pushTag(inps.TagName, inps.TagMessage);
core.endGroup();
core.info('[INFO] Action successfully completed');