Skip to content

Merge pull request #70 from fulldecent/fix/github-pages-template-fals… #51

Merge pull request #70 from fulldecent/fix/github-pages-template-fals…

Merge pull request #70 from fulldecent/fix/github-pages-template-fals… #51

name: Build, test, deploy to GitHub Pages
on:
push:
branches: ["main"]
pull_request:
workflow_dispatch: # Run this workflow manually from the Actions tab
# 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
jobs:
# Build using Jekyll, save GitHub Pages artifact and build artifact
build:
name: Jekyll build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Ruby # See https://www.ruby-lang.org/en/downloads/branches/
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
- name: Build site
run: bundle exec jekyll build
- name: Upload build artifact, ready for GitHub Pages deployment
uses: actions/upload-pages-artifact@v2
with:
path: build/
- name: Upload build artifact, ready for testing
uses: actions/upload-artifact@v3
with:
name: build-artifact
path: build/ # or the path to your Jekyll build directory
# Test the build artifact
test:
name: Test
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Setup Ruby # See https://www.ruby-lang.org/en/downloads/branches/
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
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
cache: "yarn"
- name: Install node packages
run: yarn install --immutable
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: build-artifact
path: build/
- name: Restore testing cache
uses: actions/cache/restore@v3
id: cache
with:
path: cache/
key: ${{ runner.os }}-testing
- name: Test suite
run: yarn run test
- name: Save testing cache
uses: actions/cache/save@v3
if: always()
with:
path: cache/
key: ${{ runner.os }}-testing
# Deploy the GitHub Pages artifact
deploy-github-pages:
name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
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@v2