* feat: Add disable_nojekyll and cname options * docs: Add cname and disable_nojekyll * chore: Add vim * chore(release): 3.3.0-0 * ci: Add codecov/codecov-action * refactor: Enhance warning message - Add .nojekyll file by default to only the master and gh-pages branches. When the file already exists, this action does nothing. - When we set other branches to publish_branch, this action does not add .nojekyll file. cf. https://github.com/peaceiris/actions-gh-pages/issues/112#issuecomment-589678269 Close #112 Co-authored-by: Daniel Himmelstein <daniel.himmelstein@gmail.com> Co-authored-by: Nicolas Vanhoren <nicolas.vanhoren@gmail.com>
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import * as core from '@actions/core';
|
|
import * as exec from '@actions/exec';
|
|
import {Inputs} from './interfaces';
|
|
import {getInputs} from './get-inputs';
|
|
import {setTokens} from './set-tokens';
|
|
import * as git from './git-utils';
|
|
import {getWorkDirName, addNoJekyll, addCNAME} from './utils';
|
|
|
|
export async function run(): Promise<void> {
|
|
try {
|
|
const inps: Inputs = getInputs();
|
|
|
|
await git.setConfig(inps.UserName, inps.UserEmail);
|
|
|
|
const remoteURL = await setTokens(inps);
|
|
core.debug(`[INFO] remoteURL: ${remoteURL}`);
|
|
|
|
const date = new Date();
|
|
const unixTime = date.getTime();
|
|
const workDir = await getWorkDirName(`${unixTime}`);
|
|
await git.setRepo(inps, remoteURL, workDir);
|
|
|
|
await addNoJekyll(workDir, inps.DisableNoJekyll, inps.PublishBranch);
|
|
await addCNAME(workDir, inps.CNAME);
|
|
|
|
try {
|
|
await exec.exec('git', ['remote', 'rm', 'origin']);
|
|
} catch (e) {
|
|
core.info(`[INFO] ${e}`);
|
|
}
|
|
await exec.exec('git', ['remote', 'add', 'origin', remoteURL]);
|
|
await exec.exec('git', ['add', '--all']);
|
|
|
|
await git.commit(
|
|
inps.AllowEmptyCommit,
|
|
inps.ExternalRepository,
|
|
inps.CommitMessage
|
|
);
|
|
await git.push(inps.PublishBranch, inps.ForceOrphan);
|
|
await git.pushTag(inps.TagName, inps.TagMessage);
|
|
|
|
core.info('[INFO] Action successfully completed');
|
|
|
|
return;
|
|
} catch (e) {
|
|
throw new Error(e);
|
|
}
|
|
}
|