Skip to content

Instantly share code, notes, and snippets.

@katemihalikova
Created May 30, 2022 08:30
Show Gist options
  • Save katemihalikova/5b7e58d4e736a85bfd97787a1f6d28e4 to your computer and use it in GitHub Desktop.
Save katemihalikova/5b7e58d4e736a85bfd97787a1f6d28e4 to your computer and use it in GitHub Desktop.

Deploy to GitHub Pages config for GitHub Actions

  • change default branch name (if not main) on line 5
  • change directory to take files from (if not dist) on line 20
  • save the config file as .github/workflows/gh-pages.yml
  • commit the config file into the default branch
  • turn on Pages in repo settings (if not already on)
name: Deploy to GitHub Pages
on:
push:
branches:
- main
jobs:
build-test-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm run build
- uses: crazy-max/ghaction-github-pages@v3
with:
target_branch: gh-pages
build_dir: dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment