Skip to content

Create build and deploy workflow using GitHub Actions #8

Create build and deploy workflow using GitHub Actions

Create build and deploy workflow using GitHub Actions #8

name: build and deploy
on:
push:
branches: ["main"]
env:
NODE_VERSION: 20
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- run: npm install
- run: npm run build:production
- name: Copy static files
run: cp -r ./public/. ./dist
- uses: actions/configure-pages@v4
- uses: actions/upload-pages-artifact@v3
with:
path: dist
deploy:
needs: build
name: deploy
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4