Skip to content

Refactor GitHub Actions workflow for website deployment; improve job … #9

Refactor GitHub Actions workflow for website deployment; improve job …

Refactor GitHub Actions workflow for website deployment; improve job … #9

name: Deploy Website
on:
push:
branches: [website]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
checks:
if: github.event_name != 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20.x'
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Test Build
run: |
yarn build
# Verify 404.html exists
ls -la build/ | grep 404.html || echo "404.html not found!"
gh-release:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build website
run: yarn build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: './build'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2