garygrossgarten / github-action-scp

⬆️ Copy a folder to a remote server using SSH
MIT License
189 stars 53 forks source link

No longer uploading files #51

Open RSNFreud opened 2 months ago

RSNFreud commented 2 months ago

Since the latest change, uploading files doesnt seem to work. It deletes them fine but doesnt upload.

name: build site
on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:

  build_site:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - run: npm install
    - name: Use cache
      uses: actions/cache@v4
      with:
        # See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node
        path: |
          ~/.npm
          ${{ github.workspace }}/.next/cache
        # Generate a new cache whenever packages or source files change.
        key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
        # If source files changed but packages didn't, rebuild from a prior cache.
        restore-keys: |
          ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
    - name: build site
      run: npm run build
    - name: Copy folder content recursively to remote
      uses: garygrossgarten/github-action-scp@release
      with:
        local: out
        remote: site
        host: ${{ secrets.SSH_HOST }}
        port: ${{ secrets.SSH_PORT }}
        username: ${{ secrets.SSH_USER }}
        password: ${{ secrets.SSH_PASSWORD }}
        concurrency: 5
        rmRemote: true
BernardTeske commented 2 months ago

I have a similar problem: I am using version 0.6.0 in a project. Some files are uploaded, then it takes a long time until the connection times out. The last time it worked was four months ago. Maybe it's due to a change on GitHub? Because I am not using the latest version.

RSNFreud commented 2 months ago

image For reference it seems the files are uploaded as temporary files now and never copied fully

RSNFreud commented 2 months ago

https://github.com/garygrossgarten/github-action-scp/issues/50#issuecomment-2222883601

Just confirming that running it on windows-latest works so its something with linux

roos-robert commented 2 months ago

Experiencing the same issue, running ubuntu-latest so I will try changing it to windows-latest instead.

However it's random, for example around two hours ago I ran this action and everything completed in 5 minutes (normal time), I then ran it again around one hour ago where first it timed out and failed, on the second try it did finish but after around 20 minutes.

Just leaving this here in case it helps in any way to identify the issue.

luojiyin1987 commented 2 months ago

get the same issue, run on ubuntu-latest, becase new openssh fix ?

I use other other scp github action to solved.

https://github.com/kaiyuanshe/OSS-toolbox/pull/16

fooying commented 2 months ago

Me too

I used https://github.com/appleboy/scp-action instead, which solved the problem and is more efficient

rutvik106 commented 2 months ago

Same here. What is the FIX?

msveshnikov commented 1 month ago

Doesn't work randomly, ruined my production :( Copies only ~20 files of React app then silently quits. I tried all versions, from 0.5.3 to 0.9

roos-robert commented 1 month ago

The only stable "fix" for this is to (sadly) migrate to another action, like this one https://github.com/appleboy/scp-action

I've done it for all workflows now and everything working great again.

Deepika1095 commented 1 month ago

Same error I am getting, when I try other scp github action it worked but copy my war file as directory

luojiyin1987 commented 1 month ago

Same error I am getting, when I try other scp github action it worked but copy my war file as directory我遇到同样的错误,当我尝试其他 scp github 操作时,它起作用了,但将我的 war 文件复制为目录

      - name: Transport Image
        uses: appleboy/scp-action@v0.1.7
        with:
          source: ./build/*.*
          target: /tmp/${{ env.BOX_NAME }}
          host: ${{ secrets.HOST }}
          username: ${{ secrets.USER }}
          password: ${{ secrets.PASSWORD }}
          strip_components: 1

you need set strip_components , and set source: ./build/*.*

Deepika1095 commented 1 month ago
Deepika1095 commented 1 month ago

Thanks It worked

msveshnikov commented 1 month ago

My configuration for static React via nginx:

thebaptiste commented 2 weeks ago

Same for me. An other action you can use is ssh-scp-ssh-pipelines In one single action you can chain ssh, scp and an other ssh commands. It's interesting to publish rpms for example : create a directory with the first ssh, transfer rpms in this directory by scp and run createrepo with the last ssh.