Skip to content

Commit e8cc256

Browse files
Copilotigaw
andcommitted
fix: replace sand4rt/ftp-deployer with inline sshpass+sftp
The third-party ftp-deployer action is replaced with a plain run: step using only standard Linux tools available on ubuntu-latest runners. Behaviour is identical: - SFTP upload (port 22) of nvme-cli-* files to /upload/ on the server - No remote cleanup Security improvements over the old action: - No untrusted third-party code runs in the workflow - Server host key verified against SFTP_HOST_KEY secret (no TOFU) - All secrets passed as environment variables, never on the command line - known_hosts written fresh each run (> not >>) - Glob guarded with [ -f ] to handle no-match safely A new SFTP_HOST_KEY repository secret must be added. Its value is the output of: ssh-keyscan <SFTP_SERVER> Co-authored-by: igaw <[email protected]>
1 parent c60b692 commit e8cc256

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

.github/workflows/upload.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,23 @@ jobs:
6666
name: nvme-cli
6767
path: upload
6868

69-
- name: FTP Deployer
70-
uses: sand4rt/ftp-deployer@518beaad91d1b18fd55a69321de7ed89080d2ae3 # v1.8
71-
with:
72-
sftp: true
73-
host: ${{ secrets.SFTP_SERVER }}
74-
port: 22
75-
username: ${{ secrets.SFTP_USERNAME }}
76-
password: ${{ secrets.SFTP_PASSWORD }}
77-
remote_folder: '/upload'
78-
local_folder: upload
79-
cleanup: false
80-
include: '[ "nvme-cli-*" ]'
81-
exclude: '[".github/**", ".git/**", "*.env"]'
69+
- name: upload to SFTP server
70+
env:
71+
SSHPASS: ${{ secrets.SFTP_PASSWORD }}
72+
SFTP_USERNAME: ${{ secrets.SFTP_USERNAME }}
73+
SFTP_SERVER: ${{ secrets.SFTP_SERVER }}
74+
SFTP_HOST_KEY: ${{ secrets.SFTP_HOST_KEY }}
75+
run: |
76+
sudo apt-get install -y sshpass
77+
mkdir -p ~/.ssh
78+
echo "${SFTP_HOST_KEY}" > ~/.ssh/known_hosts
79+
(
80+
echo "cd /upload"
81+
for f in upload/nvme-cli-*; do
82+
[ -f "$f" ] || continue
83+
echo "put $f $(basename "$f")"
84+
done
85+
) | sshpass -e sftp -b - "${SFTP_USERNAME}@${SFTP_SERVER}"
8286
8387
upload-release-assets:
8488
name: upload GitHub release assets

0 commit comments

Comments
 (0)