Skip to content

Deploy Docusaurus to GitHub Pages #115

Deploy Docusaurus to GitHub Pages

Deploy Docusaurus to GitHub Pages #115

name: Deploy Docusaurus to GitHub Pages
on:
# Runs on pushes targeting the default branch
push:
branches:
- main
- master
# Runs on each PR
pull_request:
branches:
- master
- main
# Deploy once every day
schedule:
- cron: "0 0 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
deploy:
name: Deploy Docusaurus to GitHub Pages
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- name: Install dependencies
run: npm ci
- name: Build website
run: npm run build
# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
if: github.event_name != 'pull_request'
uses: peaceiris/actions-gh-pages@v4
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
external_repository: vipulgupta2048/vipulgupta2048.github.io
publish_dir: ./build
- name: Deploy to GitHub Pages
if: github.event_name != 'pull_request'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build