question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React deployment doesn't work unless I commit build folder

See original GitHub issue

Hello, Firstly, I would like to thank you for this package, it has really helped me perform continuous deployment with smoothly to my FTP server without much hassle, I honestly appreciate it. Based on your documentation, I can upload my react build folder to my server without commiting it by adding !build to my .git-ftp-include file, however, I have tried but it tells me that the build folder cannot be found, when I remove build folder from .gitignore and commit then push to github it uploads to my FTP server. How can I solve this problem because I am trying to avoid pushing my build folder to github.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
margaiwangaracommented, Sep 16, 2020

Finally managed to make it work, removed the deploy job and placed all the steps under one job, your initial suggestion of placing !build/ folder in .git-ftp-include file is the solution. I’ll add my code below incase someone faces the same problem.

name: Client-Side Code For Accumulate App With React.js
'on':
  push:
    branches: master
jobs:
  FTP-Deploy-Action:
    name: FTP-Deploy-Action
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 2

      - name: Build React Project
        uses: actions/setup-node@v1
        with:
          node-version: 12.x

      - name: Cache/Restore node_modules
        uses: actions/cache@v2
        with:
          path: ~/.npm
          key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.OS }}-npm-cache-

      - name: Install Dependencies and Build
        run: |
          npm install
          npm run build --if-present
        env:
          CI: false

      - name: List output files
        run: find build/ -print

      - name: Deploy to ftp server
        uses: SamKirkland/FTP-Deploy-Action@3.1.1
        with:
          ftp-server: '${{ secrets.FTP_SERVER }}/accumulate/'
          ftp-username: '${{ secrets.FTP_USERNAME }}'
          ftp-password: '${{ secrets.FTP_PASSWORD }}'
          local-dir: build
0reactions
margaiwangaracommented, Sep 16, 2020

Hello, sorry I wasn’t able to give early feedback based on the suggestion you presented. I tried what you suggested and unfortunately, the problem still persists.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is create-react-app's build directory in .gitignore?
The build directory is in .gitignore as it can be generated from the existing files. To minimize upload/download time only essential items ...
Read more >
Deployment | Create React App
The build folder with static assets is the only output produced by Create React App. However this is not quite enough if you...
Read more >
Customize build folder #1354 - facebook/create-react-app
On a project I'm currently working on, we're using a file called BUILD that specifies build instructions for our microservices.
Read more >
Deploying React apps to GitHub Pages - LogRocket Blog
This tutorial is limited to demonstrating how to deploy a React application to GitHub Pages, so we'll leave the current setup as it...
Read more >
How to deploy React App to GitHub Pages
Did you build React app and want to deploy it, following these simple steps you able to deploy and showing the world your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found