Overview

I had an opportunity to copy build results to a Sakura rental server using GitHub Actions and SCP, so this is a memorandum of the process.

I used the following GitHub Action.

https://github.com/appleboy/scp-action

Issue Encountered

When I tried using the following notation, it worked fine when using act in the local environment, but it did not work when running on GitHub Actions.

name: scp files
on: [push]
jobs:

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: copy file via ssh password
      uses: appleboy/scp-action@master
      with:
        host: ${{ secrets.HOST }}
        username: ${{ secrets.USERNAME }}
        password: ${{ secrets.PASSWORD }}
        port: ${{ secrets.PORT }}
        source: "tests/a.txt,tests/b.txt"
        target: your_server_target_folder_path

Specifically, the following error occurred:

GitHub actions workflow error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain

The following was helpful for resolving this issue.

https://stackoverflow.com/questions/71850567/github-actions-workflow-error-ssh-handshake-failed-ssh-unable-to-authenticat

Specifically, the error was resolved by using key and passphrase as shown below:

name: scp files
on: [push]
jobs:

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: copy file via ssh password
      uses: appleboy/scp-action@master
      with:
        host: ${{ secrets.HOST }}
        username: ${{ secrets.USERNAME }}
        key: ${{ secrets.PRIVATE_KEY }}
        passphase: ${{ secrets.PASSPHRASE }}
        port: ${{ secrets.PORT }}
        source: "tests/a.txt,tests/b.txt"
        target: your_server_target_folder_path

Summary

I hope this serves as a useful reference for those experiencing similar issues.