Create jekyll-gh-pages.yml #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy React App to GitHub Pages | ||
| on: | ||
| push: | ||
| branches: ["main"] # Runs on pushes to the main branch | ||
| workflow_dispatch: # Allows manual runs | ||
| # Permissions to deploy to GitHub Pages | ||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
| # Ensures only one deployment is active at a time | ||
| concurrency: | ||
| group: "pages" | ||
| cancel-in-progress: false | ||
| jobs: | ||
| build-and-deploy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: '16' # Specify a version compatible with your project | ||
| - name: Install Dependencies | ||
| run: npm install --legacy-peer-deps | ||
| - name: Build Project | ||
| run: npm run build | ||
| - name: Deploy to GitHub Pages | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: npm run deploy | ||
| # Job to deploy the static site to GitHub Pages | ||
| deploy: | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 | ||