I am trying to deploy react app in the [username].github.io using github actions. Here is the workflow, i made that is build successfully but i see 404 error "no page found" in my [username].github.io site. What am i doing wrong here?
My workflow:
name: React CI/CD
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 14
- name: Install NPM packages
run: npm ci
- name: Build project
run: npm run build
- name: upload build files
uses: actions/upload-artifact@v2
with:
name: production-files
path: ./build
deploy:
name: Deploy
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: production-files
path: ./build
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
If anyone could guide me on this, it would be great. I am a total beginner on CI/CD topic.
CodePudding user response:
A stupid mistake from my side. Under settings, pages tab, specify branch from which github page to be built and click save.