Skip to content

Commit

Permalink
Add jekyll input option (#116)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
georgemarshall committed Jun 25, 2020
1 parent fd8b68d commit 3604e9d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Expand Up @@ -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'
Expand Down
5 changes: 5 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/main.ts
Expand Up @@ -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');
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 3604e9d

Please sign in to comment.