Skip to content

Commit

Permalink
Create build_deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjuma authored May 9, 2024
1 parent caa8e08 commit f44a25d
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build and Deploy React App to GitHub Pages

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
outputs:
page_url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16' # Adjust this to the Node.js version your project requires

- name: Install Dependencies
run: npm install

- name: Build React App
run: npm run build
# Ensure your project builds into the 'build' directory

deploy:
runs-on: ubuntu-latest
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

environment:
name: github-pages
url: ${{ needs.build.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit f44a25d

Please sign in to comment.