Compare commits

..

10 Commits

Author SHA1 Message Date
peaceiris
4bffc26030 chore(release): 3.0.4-1
Some checks failed
Release / release (push) Has been cancelled
2020-02-19 22:24:26 +09:00
peaceiris
e0aeb74f8b chore(release): Add build assets 2020-02-19 22:24:25 +09:00
peaceiris
cbe4d56fb8 fix: convert to string 2020-02-19 22:20:21 +09:00
peaceiris
0d912a1314 fix: use onetime workdir name 2020-02-19 22:17:51 +09:00
peaceiris
00311793aa fix: Add await 2020-02-19 22:02:41 +09:00
peaceiris
8e6c12a2b5 refactor: Add info message 2020-02-19 17:18:35 +09:00
peaceiris
371989e187 Merge branch 'master' into fix-remove-workdir-at-the-end 2020-02-19 12:18:15 +09:00
Shohei Ueda
195ab8005d deps: Rollback @types/node 13 to 12 (#111) 2020-02-19 12:16:41 +09:00
dependabot-preview[bot]
591c4bdf2e deps: bump @types/node from 13.7.1 to 13.7.2 (#110) 2020-02-19 02:38:01 +00:00
peaceiris
aafae3404f chore(release): Remove build assets [skip ci] 2020-02-19 02:00:29 +09:00
6 changed files with 45 additions and 24 deletions

View File

@@ -2,6 +2,26 @@
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.4-1](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.4-0...v3.0.4-1) (2020-02-19)
### deps
* bump @types/node from 13.7.1 to 13.7.2 (#110) ([591c4bd](https://github.com/peaceiris/actions-gh-pages/commit/591c4bdf2ee1c6aa5f1958c4553902feac06dcfe)), closes [#110](https://github.com/peaceiris/actions-gh-pages/issues/110)
* Rollback @types/node 13 to 12 (#111) ([195ab80](https://github.com/peaceiris/actions-gh-pages/commit/195ab8005d4af142c40fd8e53a59783b697d75d9)), closes [#111](https://github.com/peaceiris/actions-gh-pages/issues/111)
### fix
* Add await ([0031179](https://github.com/peaceiris/actions-gh-pages/commit/00311793aa104bf99501373756461475b6752f16))
* convert to string ([cbe4d56](https://github.com/peaceiris/actions-gh-pages/commit/cbe4d56fb8bd50d63919f783483f74c694a3dd9b))
* use onetime workdir name ([0d912a1](https://github.com/peaceiris/actions-gh-pages/commit/0d912a1314ce9d77f29bc0c1fada559223dd5563))
### refactor
* Add info message ([8e6c12a](https://github.com/peaceiris/actions-gh-pages/commit/8e6c12a2b5f973c8736f831398d0fe7c980f1431))
## [3.0.4-0](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.3...v3.0.4-0) (2020-02-18)

View File

@@ -2249,7 +2249,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470));
const exec = __importStar(__webpack_require__(986));
const io = __importStar(__webpack_require__(1));
const get_inputs_1 = __webpack_require__(452);
const set_tokens_1 = __webpack_require__(615);
const git = __importStar(__webpack_require__(496));
@@ -2260,7 +2259,9 @@ function run() {
yield git.setConfig(inps.UserName, inps.UserEmail);
const remoteURL = yield set_tokens_1.setTokens(inps);
core.debug(`[INFO] remoteURL: ${remoteURL}`);
const workDir = yield git.setRepo(inps, remoteURL);
const date = new Date();
const unixTime = date.getTime();
yield git.setRepo(inps, remoteURL, `${unixTime}`);
try {
yield exec.exec('git', ['remote', 'rm', 'origin']);
}
@@ -2273,7 +2274,6 @@ function run() {
yield git.push(inps.PublishBranch, inps.ForceOrphan);
yield git.pushTag(inps.TagName, inps.TagMessage);
core.info('[INFO] Action successfully completed');
io.rmRF(workDir);
return;
}
catch (e) {
@@ -8375,9 +8375,9 @@ function copyAssets(publishDir, workDir) {
});
}
exports.copyAssets = copyAssets;
function setRepo(inps, remoteURL) {
function setRepo(inps, remoteURL, unixTime) {
return __awaiter(this, void 0, void 0, function* () {
const workDir = path_1.default.join(utils_1.getHomeDir(), 'actions_github_pages');
const workDir = path_1.default.join(utils_1.getHomeDir(), `actions_github_pages_${unixTime}`);
const publishDir = path_1.default.join(`${process.env.GITHUB_WORKSPACE}`, inps.PublishDir);
core.info(`[INFO] ForceOrphan: ${inps.ForceOrphan}`);
if (inps.ForceOrphan) {
@@ -8385,7 +8385,7 @@ function setRepo(inps, remoteURL) {
process.chdir(workDir);
yield createBranchForce(inps.PublishBranch);
yield copyAssets(publishDir, workDir);
return workDir;
return;
}
const result = {
exitcode: 0,
@@ -8417,7 +8417,7 @@ function setRepo(inps, remoteURL) {
yield exec.exec('git', ['rm', '-r', '--ignore-unmatch', '*']);
}
yield copyAssets(publishDir, workDir);
return workDir;
return;
}
else {
throw new Error(`Failed to clone remote branch ${inps.PublishBranch}`);
@@ -8430,7 +8430,7 @@ function setRepo(inps, remoteURL) {
process.chdir(workDir);
yield createBranchForce(inps.PublishBranch);
yield copyAssets(publishDir, workDir);
return workDir;
return;
}
});
}

8
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.0.4-0",
"version": "3.0.4-1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -756,9 +756,9 @@
"dev": true
},
"@types/node": {
"version": "13.7.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.7.1.tgz",
"integrity": "sha512-Zq8gcQGmn4txQEJeiXo/KiLpon8TzAl0kmKH4zdWctPj05nWwp1ClMdAVEloqrQKfaC48PNLdgN/aVaLqUrluA=="
"version": "12.12.27",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.27.tgz",
"integrity": "sha512-odQFl/+B9idbdS0e8IxDl2ia/LP8KZLXhV3BUeI98TrZp0uoIzQPhGd+5EtzHmT0SMOIaPd7jfz6pOHLWTtl7A=="
},
"@types/parse-json": {
"version": "4.0.0",

View File

@@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.0.4-0",
"version": "3.0.4-1",
"description": "GitHub Actions for GitHub Pages",
"main": "lib/index.js",
"engines": {
@@ -57,7 +57,7 @@
},
"devDependencies": {
"@types/jest": "^25.1.2",
"@types/node": "^13.7.1",
"@types/node": "~12",
"@typescript-eslint/eslint-plugin": "^2.20.0",
"@typescript-eslint/parser": "^2.20.0",
"@zeit/ncc": "^0.21.0",

View File

@@ -40,9 +40,10 @@ export async function copyAssets(
export async function setRepo(
inps: Inputs,
remoteURL: string
): Promise<string> {
const workDir = path.join(getHomeDir(), 'actions_github_pages');
remoteURL: string,
unixTime: string
): Promise<void> {
const workDir = path.join(getHomeDir(), `actions_github_pages_${unixTime}`);
const publishDir = path.join(
`${process.env.GITHUB_WORKSPACE}`,
inps.PublishDir
@@ -54,7 +55,7 @@ export async function setRepo(
process.chdir(workDir);
await createBranchForce(inps.PublishBranch);
await copyAssets(publishDir, workDir);
return workDir;
return;
}
const result: CmdResult = {
@@ -92,7 +93,7 @@ export async function setRepo(
}
await copyAssets(publishDir, workDir);
return workDir;
return;
} else {
throw new Error(`Failed to clone remote branch ${inps.PublishBranch}`);
}
@@ -105,7 +106,7 @@ export async function setRepo(
process.chdir(workDir);
await createBranchForce(inps.PublishBranch);
await copyAssets(publishDir, workDir);
return workDir;
return;
}
}

View File

@@ -1,6 +1,5 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as io from '@actions/io';
import {Inputs} from './interfaces';
import {getInputs} from './get-inputs';
import {setTokens} from './set-tokens';
@@ -15,7 +14,9 @@ export async function run(): Promise<void> {
const remoteURL = await setTokens(inps);
core.debug(`[INFO] remoteURL: ${remoteURL}`);
const workDir = await git.setRepo(inps, remoteURL);
const date = new Date();
const unixTime = date.getTime();
await git.setRepo(inps, remoteURL, `${unixTime}`);
try {
await exec.exec('git', ['remote', 'rm', 'origin']);
@@ -32,9 +33,8 @@ export async function run(): Promise<void> {
);
await git.push(inps.PublishBranch, inps.ForceOrphan);
await git.pushTag(inps.TagName, inps.TagMessage);
core.info('[INFO] Action successfully completed');
io.rmRF(workDir);
core.info('[INFO] Action successfully completed');
return;
} catch (e) {