Skip to content

Set up GitHub Actions workflow for GitHub Pages deployment - 3 #4

Set up GitHub Actions workflow for GitHub Pages deployment - 3

Set up GitHub Actions workflow for GitHub Pages deployment - 3 #4

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches:
- main # Trigger on push to main branch
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3 # Latest version of checkout action
- name: Configure Git
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4 # Latest version of gh-pages action
with:
github_token: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub
publish_dir: ./ # The directory to deploy
- name: Force Push to gh-pages
run: |
git push origin gh-pages --force
- name: Clean Git Repository
run: |
rm -rf .git/
git init
git remote add origin https://github.com/rishabhjain1712/Portfolio.git
git fetch
git checkout -b gh-pages