diff --git a/.github/workflows/build_deploy.yml b/.github/workflows/build_deploy.yml new file mode 100644 index 00000000..811fbffd --- /dev/null +++ b/.github/workflows/build_deploy.yml @@ -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