jekyll-build

jekyll-build

Action for running Bundle Install and Jekyll Build within a Docker container

GHA Jekyll Build

Action for running Bundle Install and Jekyll Build within a Docker container


Table of Contents


Requirements

Access to GitHub Actions if using on GitHub, or Docker knowledge if utilizing privately.


Quick Start

Reference the code of this repository within your own workflow...

on:
  push:
    branches:
      - src-pages

jobs:
  jekyll_build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout source branch for building Pages
        uses: actions/checkout@v1
        with:
          ref: src-pages
          fetch-depth: 10

      # Note the following may not be required in future versions of Jekyll Build Actions
      - name: Make build destination directory
        run: mkdir -vp ~/www/repository-name

      - name: Jekyll Build
        uses: gha-utilities/[email protected]
        with:
          jekyll_github_token: ${{ secrets.JEKYLL_GITHUB_TOKEN }}
          source: ./
          destination: ~/www/repository-name

      - name: Checkout branch for GitHub Pages
        uses: actions/checkout@v1
        with:
          ref: pr-pages
          fetch-depth: 1
          submodules: true

      - name: Copy built site files into Git branch
        run: cp -r ~/www/repository-name ./

      - name: Add and Commit changes to pr-pages branch
        run: |
          git config --local user.email '[email protected]'
          git config --local user.name 'GitHub Action'
          git add -A .
          git commit -m 'Updates compiled site files'

      - name: Push changes
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          branch: pr-pages

      - name: Initialize Pull Request
        uses: gha-utilities/[email protected]
        with:
          pull_request_token: ${{ secrets.GITHUB_TOKEN }}
          head: pr-pages
          base: gh-pages
          title: 'Updates site files from latest Actions build'
          body: >
            Perhaps a multi-line description
            about latest features and such.

Notes

The new JEKYLL_GITHUB_TOKEN should have public_repo permissions, be assigned within your project's Secrets Settings, eg. https://github.com/<maintainer>/<repository>/settings/secrets, and generally is only required if utilizing the github-metadata from Jekyll.


To pass compiled site files to another Workflow utilize the Upload and Download Actions from GitHub...

.github/workflows/jekyll_build.yml

on:
  push:
    branches:
      - src-pages

jobs:
  jekyll_build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout source branch for building Pages
        uses: actions/checkout@v1
        with:
          ref: src-pages
          fetch-depth: 10

      - name: Make build destination directory
        run: mkdir -vp ~/www/repository-name

      - name: Jekyll Build
        uses: gha-utilities/[email protected]
        with:
          source: ./
          destination: ~/www/repository-name

      - name: Upload Built Pages
        uses: actions/[email protected]
        with:
          name: Complied-Jekyll-Pages
          path: ~/www/repository-name

.github/workflows/open_pull_request.yml

on:
  push:
    branches:
      - src-pages

jobs:
  open_pull_request:
    needs: [jekyll_build]
    runs-on: ubuntu-latest

    steps:
      - name: Checkout branch for GitHub Pages
        uses: actions/checkout@v1
        with:
          ref: gh-pages
          fetch-depth: 1
          submodules: true

      - name: Download Compiled Pages
        uses: actions/[email protected]
        with:
          name: Complied-Jekyll-Pages
          path: ./

      - name: Add and Commit changes to pr-pages branch
        run: |
          git config --local user.email '[email protected]'
          git config --local user.name 'GitHub Action'
          git add -A .
          git commit -m 'Updates compiled site files'

      - name: Push changes
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          branch: pr-pages

      - name: Initialize Pull Request
        uses: gha-utilities/[email protected]
        with:
          pull_request_token: ${{ secrets.GITHUB_TOKEN }}
          head: pr-pages
          base: gh-pages
          title: 'Updates site files from latest Actions build'
          body: >
            Perhaps a multi-line description
            about latest features and such.

Attribution


License

Legal bits of Open Source software

Jekyll Build GitHub Actions documentation
Copyright (C) 2023  S0AndS0

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation; version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
jekyll logo

Want a Jekyll website built?

Hire a Jekyll developer