A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages.
This is used along with actions/deploy-pages
as part of the official support for building Pages with Actions (currently in public beta for public repositories).
A basic Pages deployment workflow with the jekyll-build-pages
action looks like this.
name: Build Jekyll site
on:
push:
branches: ["main"]
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build
uses: actions/jekyll-build-pages@v1
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
To write to a different destination directory, match the inputs of both the jekyll-build-pages
and upload-pages-artifact
actions.
steps:
- name: Build
uses: actions/jekyll-build-pages@v1
with:
destination: "./output"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "./output"
Input | Default | Description |
---|---|---|
source |
./ |
The directory to build from |
destination |
./_site |
The directory to write output into (this should match the path input of the actions/upload-pages-artifact action) |
future |
false |
If true , writes content dated in the future |
build_revision |
$GITHUB_SHA |
The SHA-1 of the Git commit for which the build is running |
verbose |
false |
If true , prints verbose output in logs |
token |
$GITHUB_TOKEN |
The GitHub token used to authenticate API requests |
In order to release a new version of this Action:
-
Locate the semantic version of the upcoming release (a draft is maintained by the
draft-release
workflow). -
Prepare a pull request to update
action.yml
to reference the incoming version, get it approved, and merge it into themain
branch. -
Publish the draft release as a pre-release from the
main
branch with semantic version as the tag name, with:- the checkbox to publish to the GitHub Marketplace checked ☑️
⚠️ AND the checkbox to Set as a pre-release checked. ☑️
-
This will kick off a Docker publishing workflow for the newly created tag. Check the associated workflow run list to verify the new Docker image is created successfully before moving on to the next step.
-
After the Docker image has been created with the new tag, find that same pre-release and edit it. Update it with the checkbox to Set as the latest release checked ☑️ and then publish it again.
-
After publishing it as the latest release, the
release
workflow will automatically run to create/update the corresponding the major version tag such asv1
.⚠️ Environment approval is required. Check the Release workflow run list.
The scripts and documentation in this project are released under the MIT License.