README.md (1427B)
1 # 13 — Jekyll + Netlify 2 3 Build a Jekyll static site and (optionally) deploy it to Netlify. 4 5 ## What this example does 6 7 1. Checks that Jekyll is installed; installs it via `gem` if missing. 8 2. Runs `jekyll build` to generate the static site into `$JCI_OUTPUT_DIR/_site`. 9 3. Verifies the build succeeded and lists output files. 10 4. If `NETLIFY_AUTH_TOKEN` and `NETLIFY_SITE_ID` are set, zips the output and 11 deploys it to Netlify via the Netlify API. Otherwise it skips the deploy 12 gracefully. 13 5. Writes a build log to `$JCI_OUTPUT_DIR/build.log`. 14 15 ## Files 16 17 | Path | Purpose | 18 |------|---------| 19 | `.jci/run.sh` | CI entry point | 20 | `site/index.md` | Sample Jekyll page | 21 | `site/_config.yml` | Minimal Jekyll configuration | 22 | `site/_layouts/default.html` | Bare-bones HTML layout | 23 24 ## Environment variables 25 26 | Variable | Description | 27 |----------|-------------| 28 | `JCI_COMMIT` | Git commit SHA being built | 29 | `JCI_REPO_ROOT` | Root of the repository checkout | 30 | `JCI_OUTPUT_DIR` | Directory for build artifacts (also the initial cwd) | 31 | `NETLIFY_AUTH_TOKEN` | *(optional)* Netlify personal access token | 32 | `NETLIFY_SITE_ID` | *(optional)* Target Netlify site ID | 33 34 ## Running locally 35 36 ```bash 37 export JCI_COMMIT=$(git rev-parse HEAD) 38 export JCI_REPO_ROOT=$(pwd) 39 export JCI_OUTPUT_DIR=$(mktemp -d) 40 41 bash 13-jekyll-netlify/.jci/run.sh 42 ``` 43 44 To deploy, also set `NETLIFY_AUTH_TOKEN` and `NETLIFY_SITE_ID` before running.