Skip to content

Fixed the GitHub Action deployment script #32

Fixed the GitHub Action deployment script

Fixed the GitHub Action deployment script #32

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches:
- portfolio # Change this to your default branch
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22.3.0'
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build # → this calls `vite build --mode production` (as defined in package.json)
- name: Upload dist as artifact
uses: actions/upload-artifact@v4
with:
name: github-pages
path: './dist'
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write # <--- Here we need to add permissions: pages: write to directly deploy to the Pages environment.
id-token: write
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}