Skip to content

Fix: YK Web build (#395) #25

Fix: YK Web build (#395)

Fix: YK Web build (#395) #25

Workflow file for this run

name: Build and Deploy Website to GitHub Pages
on:
push: # Runs on pushes targeting the default branch
paths:
- 'website/**'
pull_request:
paths:
- 'website/**'
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
permissions: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
contents: read
pages: write
id-token: write
defaults: # Default to bash
run:
shell: bash
jobs:
build: # Build job
runs-on: ubuntu-latest
outputs:
has_pages: ${{ steps.has-pages.outputs.has_pages }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set 'has_pages' to output
id: has-pages
run: echo "has_pages=$(gh api repos/${{ github.repository }} --jq .has_pages)" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: yarn
cache-dependency-path: website/yarn.lock
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
if: github.ref == 'refs/heads/main' && steps.has-pages.outputs.has_pages == 'true'
- name: Restore cache
uses: actions/cache@v4
with:
path: |
website/build
website/.docusaurus
key: ${{ runner.os }}-docusaurus-build-${{ hashFiles('website/build') }}
restore-keys: |
${{ runner.os }}-docusaurus-build-
- name: Install dependencies
working-directory: ./website
run: yarn install
- name: Build
working-directory: ./website
run: yarn run build
- name: Upload artifact
if: github.ref == 'refs/heads/main' && steps.has-pages.outputs.has_pages == 'true'
uses: actions/upload-pages-artifact@v3
with:
path: ./website/build
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main' && needs.build.outputs.has_pages == 'true'
concurrency: # Allow one concurrent deployment
group: "pages"
cancel-in-progress: true
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4