Skip to content

Deploy to GitHub Pages #19

Deploy to GitHub Pages

Deploy to GitHub Pages #19

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
- name: Checkout gh-pages branch
run: |
git fetch origin gh-pages
git checkout gh-pages || git checkout -b gh-pages
- name: Copy build files
run: cp -r public/* .
- name: Deploy to GitHub Pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
git add .
git commit -m "Deploy to GitHub Pages" || echo "No changes to commit"
git push origin gh-pages