Skip to content

Commit f6774e2

Browse files
committed
Enable github forks to override jekyll config
The github build action will dump a `JEKYLL_CONFIG_OVERRIDES` action variable into a file `_config-overrides.yaml` which will override whatever you want in `_config.yaml`. Why: It's convenient to be able to deploy the website on a forked repository. Currently this doesn't work smoothly because by default with actions because it builds with kroxylicious.io as the url. The mechanism that configures the baseurl is also not wired up correctly. To override the url we need to add in an override configuration, so I figure we should use the same mechanism to override baseurl. The fork can set a variable containing both these values. Signed-off-by: Robert Young <robeyoun@redhat.com>
1 parent 5c4cfc9 commit f6774e2

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

.github/workflows/jekyll-gh-pages.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ jobs:
5151
tags: localhost:5000/kroxy-jekyll:latest
5252
cache-from: type=gha
5353
cache-to: type=gha,mode=max
54+
- name: Load Jekyll configuration overrides
55+
# this is to enable forks to override the url and baseurl
56+
run: echo "${{ vars.JEKYLL_CONFIG_OVERRIDES }}" > _config-overrides.yaml
5457
- name: Build with Jekyll
5558
# Outputs to the './_site' directory by default
5659
run: |
@@ -59,7 +62,7 @@ jobs:
5962
-u "$(id -u):$(id -g)" \
6063
-v "$(pwd):/site" \
6164
localhost:5000/kroxy-jekyll:latest \
62-
bash -c 'eval "$(rbenv init -)" && cp -r /css/_sass/bootstrap /site/_sass/ && bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"'
65+
bash -c 'eval "$(rbenv init -)" && cp -r /css/_sass/bootstrap /site/_sass/ && bundle exec jekyll build --config=_config.yaml,_config-overrides.yaml'
6366
env:
6467
JEKYLL_ENV: production
6568
- name: Upload artifact

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ _site
55
vendor
66
.idea
77
*.iml
8-
*/bootstrap/
8+
*/bootstrap/
9+
_config-overrides.yaml

0 commit comments

Comments
 (0)