Skip to content

Instantly share code, notes, and snippets.

@Zate
Created January 7, 2026 20:55
Show Gist options
  • Select an option

  • Save Zate/6a037f56bf62e85d1fcd5d3897d6c59c to your computer and use it in GitHub Desktop.

Select an option

Save Zate/6a037f56bf62e85d1fcd5d3897d6c59c to your computer and use it in GitHub Desktop.
# .github/workflows/deploy.yml
name: Deploy to GitHub Pages
on:
push:
branches:
- main
workflow_dispatch: # Allows manual trigger from GitHub UI
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
env:
VITE_SUPABASE_URL: ${{ secrets.VITE_SUPABASE_URL }}
VITE_SUPABASE_PUBLISHABLE_KEY: ${{ secrets.VITE_SUPABASE_PUBLISHABLE_KEY }}
- name: Add 404.html for SPA routing
run: cp dist/index.html dist/404.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1. Create the workflow file:
.github/workflows/deploy.yml
2. Add secrets in GitHub (Settings → Secrets → Actions):
- VITE_SUPABASE_URL
- VITE_SUPABASE_PUBLISHABLE_KEY
3. Change GitHub Pages source (Settings → Pages):
- Source: GitHub Actions (not branch)
4. Clean up main branch (optional but recommended):
git rm -r assets/
git commit -m "Remove built assets, using GitHub Actions now"
git push
The CNAME file in your public/ folder will automatically be included in the build, so your custom domain pridesocial.org will continue to work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment