Skip to content

Update GitHub Actions for npm build and deploy #2

Update GitHub Actions for npm build and deploy

Update GitHub Actions for npm build and deploy #2

name: Deploy with GitHub Pages and npm scripts
on:
push:
branches: [ "main" ]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install Dependencies
run: npm install
- name: Build Project
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: build-artifact
path: ./build
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: build-artifact
path: ./build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build