update lock #146
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build, test, deploy to GitHub Pages | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
workflow_dispatch: # Can 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 per branch | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
# Build using Jekyll, and Node.js, save GitHub Pages artifact and build artifact | |
build: | |
name: Jekyll build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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: Enable Corepack | |
run: corepack enable | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: "yarn" | |
check-latest: true | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Generate sitemap | |
run: yarn run generate-sitemap | |
- name: Upload build artifact, ready for GitHub Pages deployment | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: build/ | |
- name: Upload build artifact, ready for testing | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifact | |
path: build/ # the Jekyll build directory | |
include-hidden-files: true # Workaround https://github.com/actions/upload-artifact/issues/610 | |
# Test the build artifact | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: "yarn" | |
check-latest: true | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Download build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-artifact | |
path: build/ | |
- name: Restore testing cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: cache/ | |
key: test-cache | |
- name: Test suite | |
run: yarn run test | |
- name: Save testing cache | |
uses: actions/cache/save@v4 | |
if: always() | |
with: | |
path: cache/ | |
key: test-cache | |
# 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@v4 |