未使用 github 操作部署到 [username].github.io

No deployment to [username].github.io using github actions

我正在尝试使用 github 操作在 [用户名].github.io 中部署 React 应用程序。这是我创建的工作流程,它已成功构建,但我在 [用户名].github.io 站点中看到 404 错误“找不到页面”。我在这里做错了什么?

我的工作流程:

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

如果有人能在这方面指导我,那就太好了。我是 CI/CD 主题的初学者。

我犯了一个愚蠢的错误。在设置的页面选项卡下,指定要构建的 github 页面的分支,然后单击保存。