Closed cgsmith closed 1 year ago
Thanks for creating an issue. I'll look into this when I have the time. You could also create a PR yourself if you want.
I am having the same issue. I am trying to get it to just upload the entire repo to the SFTP.
This is how you can test the deployment:
npm install && npm run build
node test-action.js
const core = require('@actions/core');
const FtpDeploy = require('ftp-deploy');
core.info('Deploying...');
new FtpDeploy()
.deploy({
sftp: true,
host: 'test.rebex.net',
port: 22,
user: 'demo',
password: 'password',
remoteRoot: './',
localRoot: 'dist',
include: ['dist'],
exclude: ['node_modules/**', 'node_modules/**/.*', '.git/**']
})
.then(response => core.info('Deploy finished:', response))
.catch(error => core.error(error));
@hwalker928 I did setup a workflow for uploading only the changed files for our development deploy process. See below:
Our local folder is set for this: /home/runner/work/github-project-name/github-project-name
# This is a basic workflow to help you get started with Actions
name: Deploy to Develop
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ develop ]
# 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:
deploy:
# 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@v2
with:
fetch-depth: 2
- name: Set ENV variable
run: echo "FILES_TO_UPLOAD=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | sed ':a; N; $!ba; s/\n/", "/g' | sed 's/.*/["&"]/')" >> $GITHUB_ENV
- name: SFTP Deploy
uses: CGSmith-LLC/ftp-deployer@master
id: sftp
with:
sftp: true
port: 22
host: ${{ secrets.DEV_SFTP_HOST }}
username: ${{ secrets.DEV_SFTP_USER }}
password: ${{ secrets.DEV_SFTP_PASSWORD }}
remote_folder: ${{ secrets.DEV_SFTP_DIR }}
include: ${{ env.FILES_TO_UPLOAD }}
local_folder: ${{ secrets.DEV_SFTP_LOCAL_DIR }}
- name: Notify via Slack
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
uses: act10ns/slack@v1
with:
status: ${{ job.status }}
channel: ${{ secrets.SLACK_CHANNEL }}
if: always()
This is fixed in v1.7
The github workflow still succeeds at this point but should fail.