Skip to content

Instantly share code, notes, and snippets.

@dialguiba
Last active February 6, 2022 23:13
Show Gist options
  • Save dialguiba/ebe5404e7bae656c38653e2310f5a93b to your computer and use it in GitHub Desktop.
Save dialguiba/ebe5404e7bae656c38653e2310f5a93b to your computer and use it in GitHub Desktop.
gh-actions

GH actions for uploading to github page

.github/workflows/main.yml

React

Edit homepage in package json and also add hashrouter with react router dom

name: Build and Deploy
on: [push]
env:
REACT_APP_API_URL: ${{secrets.REACT_APP_API_URL}}
jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
runs-on: ubuntu-latest
environment: github-pages
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
run: |
yarn install --frozen-lockfile
yarn build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.2.2
with:
branch: gh-pages # The branch the action should deploy to.
folder: build # The folder the action should deploy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment