Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd8c6b06eb | ||
|
|
ae7759a398 | ||
|
|
9b7ce2a171 | ||
|
|
983978086a | ||
|
|
7859c9b784 | ||
|
|
fd54e565f4 | ||
|
|
2c6daf7153 | ||
|
|
8206a5f364 | ||
|
|
cba22ba760 | ||
|
|
87c1b90704 | ||
|
|
411de78882 | ||
|
|
9209134025 | ||
|
|
2ae4e44c71 | ||
|
|
20411ac459 | ||
|
|
76446f8a5e | ||
|
|
8fc4f66b0e | ||
|
|
6932db2544 | ||
|
|
16b8f766df | ||
|
|
ffa3183092 | ||
|
|
afad39bf81 | ||
|
|
29aefb7700 | ||
|
|
0725e5789b | ||
|
|
3b42e19751 | ||
|
|
fe2eb19a96 | ||
|
|
25b90d1c7e | ||
|
|
416f539fb4 | ||
|
|
32c9288f55 | ||
|
|
da1b4ad62b | ||
|
|
b992418825 | ||
|
|
6c8719badb | ||
|
|
47d01f16d3 | ||
|
|
5e5dc6d02e | ||
|
|
7af79a873e | ||
|
|
dd7d778958 | ||
|
|
e3aa46d23b | ||
|
|
2306f39f4e |
23
.github/dependabot.yml
vendored
23
.github/dependabot.yml
vendored
@@ -1,23 +0,0 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: npm
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: '11:00'
|
||||
timezone: Japan
|
||||
labels:
|
||||
- dependencies
|
||||
allow:
|
||||
- dependency-type: "production"
|
||||
commit-message:
|
||||
prefix: deps
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
labels:
|
||||
- "cicd"
|
||||
commit-message:
|
||||
prefix: ci
|
||||
2
.github/labeler.yml
vendored
2
.github/labeler.yml
vendored
@@ -1,4 +1,4 @@
|
||||
CI/CD:
|
||||
cicd:
|
||||
- .github/workflows/*
|
||||
|
||||
dependencies:
|
||||
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -11,6 +11,6 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# https://github.com/peaceiris/workflows/blob/main/create-release-npm/action.yml
|
||||
- uses: peaceiris/workflows/create-release-npm@v0.18.1
|
||||
- uses: peaceiris/workflows/create-release-npm@v0.19.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
14
.github/workflows/test.yml
vendored
14
.github/workflows/test.yml
vendored
@@ -29,19 +29,9 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- 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@v3
|
||||
- uses: peaceiris/workflows/setup-node@v0.19.1
|
||||
with:
|
||||
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
- name: Dump version
|
||||
run: |
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
npm ci
|
||||
npm install
|
||||
git remote prune origin
|
||||
|
||||
22
CHANGELOG.md
22
CHANGELOG.md
@@ -2,6 +2,28 @@
|
||||
|
||||
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.9.2](https://github.com/peaceiris/actions-gh-pages/compare/v3.9.1...v3.9.2) (2023-01-17)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* rename cicd ([32c9288](https://github.com/peaceiris/actions-gh-pages/commit/32c9288f553bbcbf66869cf553c82754431faf03))
|
||||
* replace npm ci with install ([9839780](https://github.com/peaceiris/actions-gh-pages/commit/983978086a87d25a1ff678aa1ef4c2acc413784a))
|
||||
|
||||
### ci
|
||||
|
||||
* add github-actions npm ([5e5dc6d](https://github.com/peaceiris/actions-gh-pages/commit/5e5dc6d02eeb18001e0a7af6d6fcbabd4fd9e2b7))
|
||||
* enable automerge ([dd7d778](https://github.com/peaceiris/actions-gh-pages/commit/dd7d77895818fd15ebecf20b6bf76028d377e1b6))
|
||||
* remove dependabot ([7af79a8](https://github.com/peaceiris/actions-gh-pages/commit/7af79a873e9c2b6c37690db94012342fdb90914a))
|
||||
* remove enabledManagers ([cba22ba](https://github.com/peaceiris/actions-gh-pages/commit/cba22ba760f1c7e62c9ae43167ea68ca9de56506))
|
||||
* use peaceiris/workflows/setup-node 0.19.1 (#818) ([416f539](https://github.com/peaceiris/actions-gh-pages/commit/416f539fb4263ec46f9bbee251e87cfeae9f85ff)), closes [#818](https://github.com/peaceiris/actions-gh-pages/issues/818)
|
||||
|
||||
### deps
|
||||
|
||||
* apply npm audit fix (#809) ([e3aa46d](https://github.com/peaceiris/actions-gh-pages/commit/e3aa46d23bbf7f669a6d92c15dda089b2edf4959)), closes [#809](https://github.com/peaceiris/actions-gh-pages/issues/809)
|
||||
|
||||
|
||||
|
||||
## [3.9.1](https://github.com/peaceiris/actions-gh-pages/compare/v3.9.0...v3.9.1) (2023-01-05)
|
||||
|
||||
|
||||
|
||||
@@ -184,6 +184,6 @@ describe('getInputs()', () => {
|
||||
|
||||
expect(() => {
|
||||
getInputs();
|
||||
}).toThrowError('Use either of enable_jekyll or disable_nojekyll');
|
||||
}).toThrow('Use either of enable_jekyll or disable_nojekyll');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -148,7 +148,7 @@ describe('setRepo()', () => {
|
||||
const date = new Date();
|
||||
const unixTime = date.getTime();
|
||||
const workDir = await getWorkDirName(`${unixTime}`);
|
||||
await expect(setRepo(inps, remoteURL, workDir)).rejects.toThrowError(
|
||||
await expect(setRepo(inps, remoteURL, workDir)).rejects.toThrow(
|
||||
'destination_dir should be a relative path'
|
||||
);
|
||||
});
|
||||
@@ -241,17 +241,13 @@ describe('setCommitAuthor()', () => {
|
||||
test('throw error user_email is undefined', async () => {
|
||||
const userName = 'custom-octocat';
|
||||
const userEmail = '';
|
||||
await expect(setCommitAuthor(userName, userEmail)).rejects.toThrowError(
|
||||
'user_email is undefined'
|
||||
);
|
||||
await expect(setCommitAuthor(userName, userEmail)).rejects.toThrow('user_email is undefined');
|
||||
});
|
||||
|
||||
test('throw error user_name is undefined', async () => {
|
||||
const userName = '';
|
||||
const userEmail = 'custom-octocat@github.com';
|
||||
await expect(setCommitAuthor(userName, userEmail)).rejects.toThrowError(
|
||||
'user_name is undefined'
|
||||
);
|
||||
await expect(setCommitAuthor(userName, userEmail)).rejects.toThrow('user_name is undefined');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -70,13 +70,13 @@ describe('setGithubToken()', () => {
|
||||
'refs/heads/gh-pages-base',
|
||||
'push'
|
||||
);
|
||||
}).toThrowError('You deploy from gh-pages-base to gh-pages-base');
|
||||
}).toThrow('You deploy from gh-pages-base to gh-pages-base');
|
||||
});
|
||||
|
||||
test('throw error master to master', () => {
|
||||
expect(() => {
|
||||
setGithubToken('GITHUB_TOKEN', 'owner/repo', 'master', '', 'refs/heads/master', 'push');
|
||||
}).toThrowError('You deploy from master to master');
|
||||
}).toThrow('You deploy from master to master');
|
||||
});
|
||||
|
||||
test('throw error external repository with GITHUB_TOKEN', () => {
|
||||
@@ -89,7 +89,7 @@ describe('setGithubToken()', () => {
|
||||
'refs/heads/master',
|
||||
'push'
|
||||
);
|
||||
}).toThrowError(`\
|
||||
}).toThrow(`\
|
||||
The generated GITHUB_TOKEN (github_token) does not support to push to an external repository.
|
||||
Use deploy_key or personal_token.
|
||||
`);
|
||||
|
||||
File diff suppressed because one or more lines are too long
10710
package-lock.json
generated
10710
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
44
package.json
44
package.json
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "actions-github-pages",
|
||||
"version": "3.9.1",
|
||||
"version": "3.9.2",
|
||||
"description": "GitHub Actions for GitHub Pages",
|
||||
"main": "lib/index.js",
|
||||
"engines": {
|
||||
"node": ">=16.18.0",
|
||||
"npm": ">=8.19.0"
|
||||
"node": ">=v16.19.0",
|
||||
"npm": ">=9.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "npx husky install",
|
||||
@@ -49,31 +49,31 @@
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/github": "^5.0.1",
|
||||
"@actions/github": "^5.1.1",
|
||||
"@actions/glob": "^0.3.0",
|
||||
"@actions/io": "^1.1.2",
|
||||
"@types/shelljs": "^0.8.11",
|
||||
"shelljs": "^0.8.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.20",
|
||||
"@types/js-yaml": "^4.0.0",
|
||||
"@types/node": "~12",
|
||||
"@typescript-eslint/eslint-plugin": "^4.16.1",
|
||||
"@typescript-eslint/parser": "^4.16.1",
|
||||
"@vercel/ncc": "^0.27.0",
|
||||
"eslint": "^7.21.0",
|
||||
"eslint-config-prettier": "^8.1.0",
|
||||
"eslint-plugin-jest": "^24.1.5",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"husky": "^5.1.3",
|
||||
"jest": "^26.6.3",
|
||||
"jest-circus": "^26.6.3",
|
||||
"js-yaml": "^4.0.0",
|
||||
"lint-staged": "^10.5.4",
|
||||
"prettier": "2.2.1",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@types/node": "~16",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.2",
|
||||
"@typescript-eslint/parser": "^5.48.2",
|
||||
"@vercel/ncc": "^0.36.0",
|
||||
"eslint": "^8.32.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"husky": "^8.0.3",
|
||||
"jest": "^29.3.1",
|
||||
"jest-circus": "^29.3.1",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lint-staged": "^13.1.0",
|
||||
"prettier": "2.8.3",
|
||||
"standard-version": "^9.1.1",
|
||||
"ts-jest": "^26.5.3",
|
||||
"typescript": "^4.2.3"
|
||||
"ts-jest": "^29.0.5",
|
||||
"typescript": "^4.9.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ else
|
||||
git pull origin --tags
|
||||
fi
|
||||
|
||||
npm ci
|
||||
npm install
|
||||
|
||||
mkdir ./lib
|
||||
npm run build
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
"extends": [
|
||||
"local>peaceiris/renovate-config"
|
||||
],
|
||||
"enabledManagers": [
|
||||
"nvm"
|
||||
"packageRules": [
|
||||
{
|
||||
"automerge": true,
|
||||
"matchUpdateTypes": ["minor", "patch"],
|
||||
"automergeStrategy": "squash"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -127,15 +127,19 @@ export async function setRepo(inps: Inputs, remoteURL: string, workDir: string):
|
||||
} else {
|
||||
throw new Error(`Failed to clone remote branch ${inps.PublishBranch}`);
|
||||
}
|
||||
} catch (e) {
|
||||
core.info(`[INFO] first deployment, create new branch ${inps.PublishBranch}`);
|
||||
core.info(`[INFO] ${e.message}`);
|
||||
await createDir(destDir);
|
||||
core.info(`[INFO] chdir ${workDir}`);
|
||||
process.chdir(workDir);
|
||||
await createBranchForce(inps.PublishBranch);
|
||||
await copyAssets(publishDir, destDir, inps.ExcludeAssets);
|
||||
return;
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
core.info(`[INFO] first deployment, create new branch ${inps.PublishBranch}`);
|
||||
core.info(`[INFO] ${error.message}`);
|
||||
await createDir(destDir);
|
||||
core.info(`[INFO] chdir ${workDir}`);
|
||||
process.chdir(workDir);
|
||||
await createBranchForce(inps.PublishBranch);
|
||||
await copyAssets(publishDir, destDir, inps.ExcludeAssets);
|
||||
return;
|
||||
} else {
|
||||
throw new Error('unexpected error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,9 +205,13 @@ export async function commit(allowEmptyCommit: boolean, msg: string): Promise<vo
|
||||
} else {
|
||||
await exec.exec('git', ['commit', '-m', `${msg}`]);
|
||||
}
|
||||
} catch (e) {
|
||||
core.info('[INFO] skip commit');
|
||||
core.debug(`[INFO] skip commit ${e.message}`);
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
core.info('[INFO] skip commit');
|
||||
core.debug(`[INFO] skip commit ${error.message}`);
|
||||
} else {
|
||||
throw new Error('unexpected error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,11 @@ import * as main from './main';
|
||||
(async (): Promise<void> => {
|
||||
try {
|
||||
await main.run();
|
||||
} catch (e) {
|
||||
core.setFailed(`Action failed with "${e.message}"`);
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
core.setFailed(`Action failed with "${error.message}"`);
|
||||
} else {
|
||||
throw new Error('unexpected error');
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
16
src/main.ts
16
src/main.ts
@@ -57,8 +57,12 @@ export async function run(): Promise<void> {
|
||||
core.startGroup('Setup Git config');
|
||||
try {
|
||||
await exec.exec('git', ['remote', 'rm', 'origin']);
|
||||
} catch (e) {
|
||||
core.info(`[INFO] ${e.message}`);
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
core.info(`[INFO] ${error.message}`);
|
||||
} else {
|
||||
throw new Error('unexpected error');
|
||||
}
|
||||
}
|
||||
await exec.exec('git', ['remote', 'add', 'origin', remoteURL]);
|
||||
await exec.exec('git', ['add', '--all']);
|
||||
@@ -86,7 +90,11 @@ export async function run(): Promise<void> {
|
||||
core.info('[INFO] Action successfully completed');
|
||||
|
||||
return;
|
||||
} catch (e) {
|
||||
throw new Error(e.message);
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
throw new Error(error.message);
|
||||
} else {
|
||||
throw new Error('unexpected error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,11 @@ export async function setTokens(inps: Inputs): Promise<string> {
|
||||
} else {
|
||||
throw new Error('not found deploy key or tokens');
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Error(e.message);
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
throw new Error(error.message);
|
||||
} else {
|
||||
throw new Error('unexpected error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user