SamKirkland / FTP-Deploy-Action

Deploys a GitHub project to a FTP server using GitHub actions
MIT License
3.93k stars 374 forks source link

Strange question with my server,can't create folder and can't upload files #195

Closed xinyu3ru closed 3 years ago

xinyu3ru commented 3 years ago

Bug Description FTP deploy running OK with other test FTP sever,but not work properly with my service server. ftp account and password is right,I can upload files with other software.

log with this My Action Config

# This is a basic workflow to help you get started with Actions

name: FTP部署

# Controls when the action will run. 
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  web-deploy:
    name: 🎉 开始部署
    runs-on: ubuntu-latest
    steps:
    - name: 🚚 获取最新代码
      uses: actions/checkout@v2

    - name: 📂 同步文件
      uses: SamKirkland/FTP-Deploy-Action@4.0.0
      with:
        server: ${{ secrets.FTP_IP }}
        username: ${{ secrets.FTP_USER }}
        password: ${{ secrets.FTP_PASSWORD }}

        #调用宝塔那边的webhook重启python运行环境,让整个项目生效。
    - name: 调用webhook
      uses: distributhor/workflow-webhook@v1
      env:
        webhook_url: ${{ secrets.WEBHOOK_URL }}
        webhook_secret: ${{ secrets.WEBHOOK_SECRET }}

My Action Log

No file exists on the server "./.ftp-deploy-sync-state.json" - this much be your first publish! 🎉
The first publish will take a while... but once the initial sync is done only differences are published!
If you get this message and its NOT your first publish, something is wrong.
----------------------------------------------------------------
Local Files:    54
Server Files:   54
----------------------------------------------------------------
Calculating differences between client & server
----------------------------------------------------------------
➕ Upload: requirements.txt
➕ Upload: runserver.py
📁 Create: xlsx2vcf
➕ Upload: xlsx2vcf.pyproj
----------------------------------------------------------------
Making changes to 54 files to sync server state
Uploading: 1.55 MB -- Deleting: 0 B -- Replacing: 0 B
----------------------------------------------------------------
creating folder "xlsx2vcf/"
Error: Client is closed
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3704:29
    at new Promise (<anonymous>)
    at FTPContext.handle (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3684:16)
    at Client.sendIgnoringError (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:2745:25)
    at Client._openDir (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3251:20)
    at Client.ensureDir (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3242:24)
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:1962:121
    at Generator.next (<anonymous>)
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:1823:71
    at new Promise (<anonymous>)
Closing reason: Error: Timeout (control socket)
    at Socket.<anonymous> (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3793:58)
    at Object.onceWrapper (events.js:299:28)
    at Socket.emit (events.js:210:5)
    at Socket._onTimeout (net.js:469:8)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7) {
  code: '0'
}
Error: Client is closed
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3704:29
    at new Promise (<anonymous>)
    at FTPContext.handle (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3684:16)
    at Client.sendIgnoringError (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:2745:25)
    at Client._openDir (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3251:20)
    at Client.ensureDir (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3242:24)
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:1962:121
    at Generator.next (<anonymous>)
    at /home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:1823:71
    at new Promise (<anonymous>)
Closing reason: Error: Timeout (control socket)
    at Socket.<anonymous> (/home/runner/work/_actions/SamKirkland/FTP-Deploy-Action/4.0.0/dist/index.js:3793:58)
    at Object.onceWrapper (events.js:299:28)
    at Socket.emit (events.js:210:5)
    at Socket._onTimeout (net.js:469:8)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7) {
  code: '0'
}
----------------------------------------------------------------
Time spent hashing:               51 milliseconds
Time spent connecting to server:  1.9 seconds
Time spent deploying:             3 milliseconds (574 MB/second)
  - changing dirs:                430 milliseconds
  - logging:                      152 milliseconds
----------------------------------------------------------------
Total time:                       32.6 seconds
----------------------------------------------------------------
xinyu3ru commented 3 years ago

older code works well

# This is a basic workflow to help you get started with Actions

name: FTP部署

# Controls when the action will run. 
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@master

      # Runs a single command using the runners shell
      - name: 初始化环境
        run:  |
          sudo apt-get update
          sudo apt-get install -y git
          sudo apt-get install -y git-ftp

      # Runs a set of commands using the runners shell
      - name: 开始ftp同步
        run: |
          #替换你的ip或域名
          git config git-ftp.url ${{ secrets.FTP_IP }}
          #替换你的ftp账户
          git config git-ftp.user ${{ secrets.FTP_USER }}
          #替换你的ftp密码        
          git config git-ftp.password ${{ secrets.FTP_PASSWORD }}
          #--disable-epsv可选,因为我的服务器不支持epsv
          git ftp push --auto-init -vv --disable-epsv --changed-only -f
        #调用宝塔那边的webhook重启python运行环境,让整个项目生效。
      - name: 调用webhook
        uses: distributhor/workflow-webhook@v1
        env:
          webhook_url: ${{ secrets.WEBHOOK_URL }}
          webhook_secret: ${{ secrets.WEBHOOK_SECRET }}
xinyu3ru commented 3 years ago

finally, I find the problem in config server needs ftps

protocol: ftps



name: FTP部署

# Controls when the action will run. 
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  web-deploy:
    name: 🎉 开始部署
    runs-on: ubuntu-latest
    steps:
    - name: 🚚 获取最新代码
      uses: actions/checkout@v2

    - name: 📂 同步文件
      uses: SamKirkland/FTP-Deploy-Action@4.1.0
      with:
        server: ${{ secrets.FTP_IP }}
        username: ${{ secrets.FTP_USER }}
        password: ${{ secrets.FTP_PASSWORD }}
        local-dir: ./xlsx2vcf/
        server-dir: xlsx2vcf/
        log-level: verbose
        protocol: ftps

        #调用宝塔那边的webhook重启python运行环境,让整个项目生效。
    - name: 调用webhook
      uses: distributhor/workflow-webhook@v1
      env:
        webhook_url: ${{ secrets.WEBHOOK_URL }}
        webhook_secret: ${{ secrets.WEBHOOK_SECRET }}```