Add jekyll input option (#116)

GitHub Pages will use Jekyll to build your site by default. This input
option allows for this functionality to be disabled. The option is left
to `true` by default as setting to `false` will cause the `.nojekyll`
file to be written to the output directory.

https://help.github.com/en/github/working-with-github-pages/about-github-pages#static-site-generators
This commit is contained in:
George Marshall 2020-06-25 00:24:31 -07:00 committed by GitHub
parent fd8b68dfa7
commit 3604e9d98b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 0 deletions

View File

@ -133,6 +133,7 @@ Following inputs can be used as `step.with` keys
| `author` | String | Author name and email address as `Display Name <joe@foo.bar>` (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

View File

@ -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'

5
dist/index.js generated vendored
View File

@ -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) {

View File

@ -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) {