Giter Club home page Giter Club logo

ftp-deployer's Introduction

GitHub action - SFTP / FTP deployer

Simple SFTP / FTP deployment with NodeJS.

Example

- name: FTP Deployer
  uses: sand4rt/[email protected]
  with:
    sftp: false # optional
    host: ${{ secrets.FTP_HOST }} # e.g. ftp.host.com or sftp.host.com (without ftp:// or ftps://)
    port: 21 # optional, default is: 21
    username: ${{ secrets.FTP_USERNAME }} # FTP username
    password: ${{ secrets.FTP_PASSWORD }} # FTP password
    remote_folder: ${{ secrets.FTP_REMOTE_FOLDER }} # optional, remote path of your FTP server
    local_folder: dist # optional, local path, default is: dist
    cleanup: false # optional, remove existing files inside FTP remote folder
    include: '[]' # optional, e.g. '['dist']'
    exclude: '[]' # optional, e.g. '['node_modules/**', '.git/**', '*.env']'
    passive: true # optional

ftp-deployer's People

Contributors

dependabot[bot] avatar jbampton avatar sand4rt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ftp-deployer's Issues

[DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

Config code:

      - name: FTP Deployer
        uses: sand4rt/[email protected]
        with:
          sftp: true
          host: ${{ secrets.SERVER_HOST }}
          port: 22
          username: ${{ secrets.SERVER_USERNAME }}
          password: ${{ secrets.SERVER_PASSWORD }}
          remote_folder: ${{ secrets.SERVER_PATH }}
          local_folder: '.'
          cleanup: false
          include: '[ "*", "**/*" ]'
          exclude: '["node_modules/**", ".github/**", ".git/**", "*.env"]'
          pasive: true

Error:

[DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

Error: Cannot find module '@actions/core'

jobs:
  build:
    name: Production
    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v2-beta
      with:
        node-version: '12.18.3'
           
    # other stuff
    
    - name: Deploy
      uses: sand4rt/[email protected]
      with:
        host: ************
        username: ************
        password: ************
        local_folder: ************
        cleanup: true
internal/modules/cjs/loader.js:800
    throw err;
    ^

Error: Cannot find module '@actions/core'
Require stack:
- D:\a\_actions\sand4rt\ftp-deployer\v0.1\index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
    at Function.Module._load (internal/modules/cjs/loader.js:690:27)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (D:\a\_actions\sand4rt\ftp-deployer\v0.1\index.js:1:14)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'D:\\a\\_actions\\sand4rt\\ftp-deployer\\v0.1\\index.js' ]
}

Upgrade to use Node.js 20

Github requires upgrade of actions to use Node.js 20. Build annotation using this project:

Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: sand4rt/[email protected]. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.

A warning for version 1.4

on: [push]

jobs:
  mirror_with_sftp:
    name: deploy
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: FTP Deployer
        uses: sand4rt/[email protected]
        with:
          sftp: true
          host: ${{ secrets.SERVER_HOST }}
          port: 22
          username: ${{ secrets.SERVER_USERNAME }}
          password: ${{ secrets.SERVER_PASSWORD }}
          remote_folder: ${{ secrets.SERVER_PATH }}
          local_folder: '.'
          cleanup: false
          include: '[ "*", "**/*" ]'
          exclude: '["src/core/db.php", "node_modules/**", "_secret.php", ".github/**", ".git/**", "*.env"]'
          pasive: true

Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: actions/checkout@v2, sand4rt/[email protected]

image

Error: dist/ is not an existing location

I really appreciate, the effort you put into this.

in github actions i get error:

Run sand4rt/[email protected] Deploying... (node:1656) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. Err dist/ is not an existing location Error: Error: dist/ is not an existing location

here is snippet for YAML
jobs: FTP-Deploy-Action: name: FTP-Deploy-Action runs-on: ubuntu-latest steps: - uses: actions/[email protected] with: fetch-depth: 2 - name: FTP Deployer uses: sand4rt/[email protected] with: sftp: false # optional host: ${{ secrets.CF_FTP_SERVER }} # e.g. ftp.host.com or sftp.host.com (without ftp:// or ftps://) port: 21 # optional, default is: 21 username: ${{ secrets.CF_FTP_USER_NAME }} # FTP username password: ${{ secrets.CF_FTP_USER_PASS }} # FTP password remote_folder: "demo/" # optional, remote path of your FTP server local_folder: "dist/" # optional, local path, default is: dist cleanup: false # optional, remove existing files inside FTP remote folder exclude: '["node_modules/**",".git/**","*.env,img/**","images/**","Backups/**","logs/**","ups2csv/**","Witango5Admin/**","CFSITEMAP-ALPHA_files/**","CFSITEMAP_files/**","aspnet_client/**"]' passive: true

please note I have tried

  1. local_folder: "dist/" # optional, local path, default is: dist
  2. local_folder: dist/ # optional, local path, default is: dist
  3. local_folder: dist # optional, local path, default is: dist
  4. i removed the local_folder: and still git same error

not able to upload .htaccess

Hi

i try to upload my webpage but the .htaccess file do not want to upload. Any idea why? is it because of the . in the beginning?

Thanks for your help.

KR
Nischi

JSONparse error when using the example with exclude

After trying a while, I figured out, it must be
exclude: '["node_modules/", ".git/", "*.env"]'

The whole array must be in a string and all values must be in double ".

Also I get this warning:
(node:2932) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

(node:1715) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

    - name: FTP Deployer
      uses: sand4rt/[email protected]
      with:
        sftp: true
        host: ${{ secrets.SERVER_HOST }}
        port: ${{ secrets.SERVER_PORT }}
        username: ${{ secrets.SERVER_USERNAME }}
        password: ${{ secrets.SERVER _PASSWORD }}
        remote_folder: '/home/maxbase/public_html/test/'
        local_folder: 'build/'
        cleanup: false
        include: '[ "*", "**/*" ]'
        exclude: '["node_modules/**", ".github/**", ".git/**", "*.env"]'

Actions not works after upgrade from 1.4 to 1.5

The following job works:

      
    - name: FTP Deployer
      uses: sand4rt/[email protected]
      with:
        sftp: true
        host: asrez.com
        port: 22
        username: username
        password: ${{ secrets.FTP_PASSWORD }}
        remote_folder: '/home/maxbase/public_html/test-react/'
        local_folder: 'build/'
        cleanup: false
        include: '[ "*", "**/*" ]'
        exclude: '["node_modules/**", "_secret.php", ".github/**", ".git/**", "*.env"]'
        pasive: true

But when you change version from 1.4 to 1.5, It not works (Also we must remove pasive):

      
    - name: FTP Deployer
      uses: sand4rt/[email protected]
      with:
        sftp: true
        host: asrez.com
        port: 22
        username: username
        password: ${{ secrets.FTP_PASSWORD }}
        remote_folder: '/home/maxbase/public_html/test-react/'
        local_folder: 'build/'
        cleanup: false
        include: '[ "*", "**/*" ]'
        exclude: '["node_modules/**", "_secret.php", ".github/**", ".git/**", "*.env"]'

Errors in log

I just ran it in my Workflow, it did deploy correctly, but finished with this log

Run sand4rt/[email protected]
Deploying...
(node:3404) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Error: TypeError: core.log is not a function```

DeprecationWarning: Buffer() is deprecated due to security and usability issues

Run sand4rt/[email protected]
(node:3021) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Deploying...
/home/runner/work/_actions/sand4rt/ftp-deployer/v1.1/dist/index.js:11609
return reentry();
^

ReferenceError: reentry is not defined
at /home/runner/work/_actions/sand4rt/ftp-deployer/v1.1/dist/index.js:11609:11
at Socket. (/home/runner/work/_actions/sand4rt/ftp-deployer/v1.1/dist/index.js:11668:7)
at Object.onceWrapper (events.js:300:26)
at Socket.emit (events.js:210:5)
at TCP. (net.js:659:12)

Include and Exclude incorrect formatting

The example given in the readme for the include and exclude is incorrect formatting. Should change it to this

    include: [] # optional, e.g. '["dist"]'
    exclude: [] # optional, e.g. '["node_modules/**", ".git/**", "*.env"]'

confusing action param

It says in readme:

    include: '' # optional, e.g.
      # - dist
    exclude: '' # optional
      # - node_modules/**
      # - node_modules/**/.*
      # - .git/**
      # - *.env

seems that I need to provide a yaml raw list, but actually:
index.js

include: JSON.parse(core.getInput('include')) || ['*', '**/*'], // this would upload everything except dot files
exclude: JSON.parse(core.getInput('exclude')) || ['node_modules/**', 'node_modules/**/.*', '.git/**'], // e.g. exclude sourcemaps, and ALL files in node_modules (including dot files)

It parses a json array string.
I think no one will understand how to deploy this action until he or she read index.js

Remove pasive from readme (for version 1.5)

Warning: Unexpected input(s) 'pasive', valid inputs are ['sftp', 'host', 'port', 'username', 'password', 'remote_folder', 'local_folder', 'cleanup', 'include', 'exclude', 'passive']

It seems "pasive" not supported in version 1.5 but it supported in version 1.4

DeprecationWarning: Buffer()

(node:1714) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.