name: Deploy on: push: branches: - main concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: deploy-production: runs-on: ubuntu-latest environment: name: Production url: 'https://batnoter.com' steps: - uses: actions/checkout@v2 - name: build react app env: # REACT_APP_BASENAME is the dir where app is deployed. It is used to specify the basename for react router. # it is useful in case you are deploying to github pages & app is served from https://username.github.io/repository # in this case you can simply specify the repository name as the value of this variable. # set this empty if the app is being deployed to the root location. REACT_APP_BASENAME: "" # REACT_APP_API_SERVER is the url of batnoter api server REACT_APP_API_SERVER: https://api.batnoter.com run: | npm ci npm run build # patch the build to support routing on github pages # since we are deploying the application on github pages and github pages only acts as the static file server, # the page reload action on a custom route will cause 404 failure. reference - https://create-react-app.dev/docs/deployment/#serving-apps-with-client-side-routing # this patch resolves 404 issue on page reload. read more at - https://github.com/rafgraph/spa-github-pages echo '' >> ./build/404.html sed -i 's/<\/head>/