Skip to content

Also run build and test on PRs #30

Also run build and test on PRs

Also run build and test on PRs #30

name: build-and-deploy
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-test:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Build
run: |
npm ci
npm run build
env:
MODE: production
- name: Test
run: npm test
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: 'build'
path: './'
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
needs: build-and-test
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: 'build'
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: './app'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4