Skip to content

Build and Deploy to GitHub Pages #1038

Build and Deploy to GitHub Pages

Build and Deploy to GitHub Pages #1038

Workflow file for this run

---
name: Build and Deploy to GitHub Pages
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Runs on pushes targeting the default branch
push:
branches:
- main
paths-ignore:
- ".github/**"
- "_drafts/**"
- ".gitattributes"
- ".gitignore"
- "Gemfile"
- "LICENSE"
- "README.md"
schedule:
- cron: "0 0 * * *"
# 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.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
# Default to bash
defaults:
run:
shell: bash
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Theme
uses: actions/checkout@v4
with:
repository: groveld/jekyll-theme
ref: main
- name: Checkout Content
uses: actions/checkout@v4
with:
ref: main
path: .content
- name: Merge Content with Theme
run: |
rm -rf "./_posts/"
rsync -av --exclude ".git*" --exclude "LICENSE" --exclude "README.md" "./.content/" "./"
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3 # 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 Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Build Jekyll
run: bundle exec jekyll build
env:
JEKYLL_ENV: production
- name: Install PurgeCSS and remove unused CSS
run: |
npm i -g purgecss
purgecss --css "./_site/**/*.css" --content "./_site/**/*.html"
- name: Validate Jekyll
run: bundle exec htmlproofer "_site/" --checks Images,Scripts,Favicon --disable-external
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./_site/
# Deployment job
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4