Updates to GitHub Actions #33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
artifact_name: github-pages | |
token: ${{ secrets.GITHUB_TOKEN }} |