Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dist folder not uploaded #43

Closed
jorenbroekema opened this issue Feb 19, 2020 · 4 comments
Closed

dist folder not uploaded #43

jorenbroekema opened this issue Feb 19, 2020 · 4 comments

Comments

@jorenbroekema
Copy link

Bug Description

I want to use this action for uploading the resulting folder of npm run build which is a dist folder in root. My workflow properly builds it and listing the folders shows it's correct, but then the build folder is not uploaded to SFTP as intended.

I might be mistaken but I think this has to do with it using git-ftp under the hood now since v3?
Which I think checks which files have been changed and committed?

The thing is, I have the /dist/ folder in my .gitignore, because I don't want to have that folder be part of my version control, because it isn't source code. It's production / distribution code, only to be built when I push something new to master, and then to be deployed on my server.

My Action Config

on:
  push:
    branches:
      - master
name: Publish Website
jobs:
  FTP-Deploy-Action:
    name: FTP-Deploy-Action
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
      with:
        fetch-depth: 2

    - name: Use Node.js 12.x
      uses: actions/setup-node@v1
      with:
        node-version: '12.x'

    - name: Build Project
      run: |
        npm install
        npm run build --if-present

    - name: List output files
      run: ls

    - name: List dist files
      run: cd dist && ls

    - name: FTP-Deploy-Action
      uses: SamKirkland/FTP-Deploy-Action@3.0.0
      with:
        ftp-server: sftp://188.166.61.51
        ftp-username: joren
        ftp-password: ${{ secrets.FTP_PASSWORD }}
        git-ftp-args: --insecure --remote-root home/joren/yc-bank-frontend --all
        local-dir: dist

I put the --all flag just to see if it would help but it doesn't.

My Action Log

     Wed Feb 19 20:47:47 UTC 2020: The remote sha1 is saved in file '.git-ftp.log'.
  Wed Feb 19 20:47:47 UTC 2020: Check if curl is functional.
  Wed Feb 19 20:47:47 UTC 2020: Retrieving last commit from sftp://joren:***@188.166.61.51/home/joren/yc-bank-frontend/.
  #=#=#                                                                         
  ##O#- #                                                                       
  ##O=#  #                                                                      
  #=#=-#  #                                                                     
  -#O#- #   #                                                                   
  -=#=#   #   #                                                                 
  -=O#- #  #    #                                                               
  -=O=#  #   #   #                                                              
  
  ######################################################################## 100.0%
  Wed Feb 19 20:47:50 UTC 2020: Taking all files.
  Wed Feb 19 20:47:50 UTC 2020: No files to sync. All changed files ignored.
  Wed Feb 19 20:47:50 UTC 2020: There are no files to sync.
  Wed Feb 19 20:47:50 UTC 2020: Uploading commit log to sftp://joren:***@188.166.61.51/home/joren/yc-bank-frontend/.git-ftp.log.
  #=#=#                                                                         
  ##O#- #                                                                       
  ##O=#  #                                                                      
  #=#=-#  #                                                                     
  -#O#- #   #                                                                   
  -=#=#   #   #                                                                 
  -=O#- #  #    #                                                               
  -=O=#  #   #   #                                                              
  -=O=-#  #    #   #                                                            
  Wed Feb 19 20:47:52 UTC 2020: Last deployment changed from aadf920b6030699d9137fe1d56d497a8bed7021e to 7462f39642bea68d75e12f8d05a102afeea457b2.
✅ Deploy Complete

I wasn't sure if the above is the action log you meant, let me know if you need more info.

Here's the repo btw: https://github.com/jorenbroekema/yc-bank-frontend/

@jorenbroekema
Copy link
Author

Update: removing dist from gitignore also doesn't work, perhaps because it is still considered "untracked" and not "changed"?

@SamKirkland
Copy link
Owner

Hey Joren,

Version 3 will only upload tracked files by default (files committed to your github project). The reason for this change was so only diffs are uploaded rather than all files on every publish. This reduces publish time for large websites from hours to minutes but requires more setup initially.

To resolve this you must create a .git-ftp-include file in the root of your project with the content !dist/ so the folder is always uploaded. Or you can commit that file to git and only diffs will be published. See docs for more information

This is actually the second issue about this today (see #42) so I'm going to make the instructions much more clear :)

I'm going to close out this issue, let me know if this doesn't resolve the issue and i'll reopen.

@jorenbroekema
Copy link
Author

I understand. Extremely confusing that the ! is used to include something in an include file 🤔 🤔 but that's on git-ftp, thanks for pointing it out to me.

I'll also reference git-ftp/git-ftp#325 just to point out that there is no glob support for .git-ftp-include which makes it a sub-optimal solution for certain projects, luckily I don't really need it for my project.

Lastly, having your dist folder committed to git can be very strenuous in large corporate apps with lots of file splitting, where the amount of files can go into the thousands for the production-folder of the application.

Using 2.0.0 may be the most acceptable solution for some people, just noting here that in 2.0.0 everything works fine :P

@SamKirkland
Copy link
Owner

Fair feedback.

The major issue with using FTP for deployments is the lack of file diffing. Over the last year the majority of the feature requests on this action have been requests for performance improvements (make uploading faster). Going with git-ftp has some major trade-offs on initial setup. However git-ftp is much more consistent by leveraging existing git tracking rather than building a diffing library based on modified times (which has plenty of edge cases that will cause partial deployments).

For the *.js support request, which files are you attempting to avoid publishing? .js.map files? If that's the case a unique webpack build for production or manually running a find . -type f ! -name "*.js" -exec rm {} \; after the build but before the publish might be a better approach vs relying on git-ftp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants