Merge pull request #110 from qitianshi/update-privacy-policy #251
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
# Builds the website using Jekyll and deploys to GitHub Pages. | |
# Adapted from https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml. | |
# Copyright 2023 Qi Tianshi. All rights reserved. | |
name: Build and deploy | |
on: | |
push: | |
branches: | |
- main | |
# Test-builds pull requests to check compatibility. | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
no_deploy: | |
description: "Test build without deploying" | |
type: boolean | |
default: false | |
# Sets permissions of GITHUB_TOKEN to allow deployment to GitHub Pages. | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
# Builds with webpack and Jekyll. | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
# Runs `bundle install` and caches installed gems automatically. | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.1' | |
bundler-cache: true | |
cache-version: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.2" | |
cache: "npm" | |
cache-dependency-path: "package-lock.json" | |
# Installs production dependencies from package.json. | |
- name: Install npm packages | |
run: | | |
npm ci --omit=dev | |
- name: Configure Pages | |
id: pages | |
uses: actions/configure-pages@v5 | |
# Bundles ./src/_webpack files into static assets. | |
- name: Bundle with webpack | |
run: | | |
webpack --mode production | |
# Builds Jekyll and outputs to ./_site. | |
- name: Build with Jekyll | |
run: | | |
bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" | |
env: | |
JEKYLL_ENV: production | |
# Uploads the artifact from the ./_site directory. | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
# Deploys to GitHub Pages. | |
deploy: | |
# This step is not run if the workflow trigger was `pull_request`, or | |
# `workflow_dispatch` with `no_deploy` set to `true`. | |
if: | | |
!(github.event_name == 'pull_request' || github.event.inputs.no_deploy) | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
# Allows only one concurrent deployment. | |
concurrency: | |
group: "deploy-pages" | |
cancel-in-progress: true | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |