Skip to content

Merge pull request #72 from logicly-au/update-build-publish-workflow #76

Merge pull request #72 from logicly-au/update-build-publish-workflow

Merge pull request #72 from logicly-au/update-build-publish-workflow #76

name: Build and publish gh-pages website
# Based on github's starter workflow
# https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
build-and-validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2' # 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: Build with Jekyll
# Outputs to the './_site' directory by default
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
- name: HTML proofer
uses: docker://18fgsa/html-proofer
with:
args: /github/workspace/_site --disable-external --empty-alt-ignore --url-ignore "/^#$/"
- name: HTML5 validator
uses: docker://logicly/html5validator
with:
entrypoint: html5validator
args: --root /github/workspace/_site
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v3
# Publish
publish:
name: Publish to GH pages (main only)
needs: [ build-and-validate ]
if: github.ref_name == 'main'
# only one concurrent publish job
concurrency:
group: "publish-pages"
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4