diff --git a/README.md b/README.md index a2e6cf0c051..235393c1555 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,7 @@ Following inputs can be used as `step.with` keys | `author` | String | Author name and email address as `Display Name ` (defaults to the GitHub Actions bot user) | | `commit_message` | String | Commit message (default `Deploy to GitHub pages`) | | `fqdn` | String | Write the given domain name to the CNAME file | +| `jekyll` | Bool | Allow Jekyll to build your site (default `true`) | ### environment variables diff --git a/action.yml b/action.yml index c4c744258c7..3cf99a93efa 100644 --- a/action.yml +++ b/action.yml @@ -37,6 +37,10 @@ inputs: fqdn: description: 'Write the given domain name to the CNAME file' required: false + jekyll: + description: 'Allow Jekyll to build your site' + default: 'true' + required: false runs: using: 'node12' diff --git a/dist/index.js b/dist/index.js index a7a5e750606..65b725da9b0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1799,6 +1799,7 @@ function run() { const author = core.getInput('author') || git.defaults.author; const commitMessage = core.getInput('commit_message') || git.defaults.message; const fqdn = core.getInput('fqdn'); + const jekyll = /false/i.test(core.getInput('jekyll')); if (!fs.existsSync(buildDir)) { core.setFailed('Build dir does not exist'); return; @@ -1840,6 +1841,10 @@ function run() { core.info(`✍️ Writing ${fqdn} domain name to ${path.join(tmpdir, 'CNAME')}`); yield fs.writeFileSync(path.join(tmpdir, 'CNAME'), fqdn.trim()); } + if (jekyll) { + core.info(`🚫 Disabling Jekyll support via ${path.join(tmpdir, '.nojekyll')}`); + yield fs.writeFileSync(path.join(tmpdir, '.nojekyll'), ''); + } const isDirty = yield git.isDirty(); core.debug(`isDirty=${isDirty}`); if (keepHistory && remoteBranchExists && !isDirty) { diff --git a/src/main.ts b/src/main.ts index 572bb7f9f47..1d4dbf9aa18 100644 --- a/src/main.ts +++ b/src/main.ts @@ -17,6 +17,7 @@ async function run() { const author: string = core.getInput('author') || git.defaults.author; const commitMessage: string = core.getInput('commit_message') || git.defaults.message; const fqdn: string = core.getInput('fqdn'); + const jekyll: boolean = /false/i.test(core.getInput('jekyll')); if (!fs.existsSync(buildDir)) { core.setFailed('Build dir does not exist'); @@ -63,6 +64,11 @@ async function run() { await fs.writeFileSync(path.join(tmpdir, 'CNAME'), fqdn.trim()); } + if (jekyll) { + core.info(`🚫 Disabling Jekyll support via ${path.join(tmpdir, '.nojekyll')}`); + await fs.writeFileSync(path.join(tmpdir, '.nojekyll'), ''); + } + const isDirty: boolean = await git.isDirty(); core.debug(`isDirty=${isDirty}`); if (keepHistory && remoteBranchExists && !isDirty) {