Skip to content

Deploy Jekyll site to Pages #91

Deploy Jekyll site to Pages

Deploy Jekyll site to Pages #91

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll site to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# Allow canceling of the in-progress deployment now.
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0
with:
ruby-version: '3.1' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Run custom preparation steps
run: |
echo "Updating navigation.yml"
pwd
# Last param turns off jekyll build for the links, let it be done in the next step
# with the same parameters we use for the real site build
#
./_tools/navgen "./doc" "./_data/navigation.yml" "no"
ls -Al _data/navigation.yml
# This one is just for sure to have our final scripts result inplace
# as in the following _site build step the assets/js folder will be modified unfortunately
# Theoretically, the site build will not hurt the already presented files
# See bellow for more
#
echo "Updating main.min.js and re-pack js scripts"
pwd
./_tools/pack debug
ls -AlR assets/js
- name: Build with Jekyll
# Outputs to the './_site' directory by default
run: |
# A double build is needed currently as the _data/links/ content must be rendered from the final html output, so
# the first run cannot use the not yet existing links
#
JEKYLL_BUILD_LINKS=yes bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
JEKYLL_BUILD_TOOLTIPS=yes bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
ls -AlR ./_site/assets/js
env:
JEKYLL_ENV: production
- name: Run custom after build steps
# Seems jekyll build finds references from the minimal-mistakes bundle to the assets/js folder scripts
# even though most of them are packed in assets/js/main.min.js
# Re-packing only the required ones and overwrite the assets/js with the minimal result needed
# For more see the _tools/pack script
# TODO: Eliminate this later (probably building purely from local source the minimal-mistakes will solve this)
# TODO: Double-check if it's still needed
run: |
echo "Updating main.min.js and re-pack js scripts"
pwd
./_tools/pack debug
ls -AlR _site/assets/js
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v3
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4