milanmk / actions-file-deployer

Composite GitHub Action (Linux runner) for deploying repository content to remote server. Fast and customizable deployment with proxy support. Deploy only changed files or do full sync/mirror of repository content.
The Unlicense
62 stars 14 forks source link

Another "full" sync works, "delta" doesn't issue #36

Closed wtflm closed 2 months ago

wtflm commented 3 months ago

With a workflow like this:

jobs:
  deploy:
    name: Deploy to production
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4.1.7
        with:
          fetch-depth: 0
          submodules: true
          ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}

      - uses: milanmk/actions-file-deployer@1.14
        with:
          remote-host: ${{ secrets.REMOTE_HOST }}
          remote-user: ${{ secrets.REMOTE_USER }}
          remote-password: ${{ secrets.REMOTE_PASSWORD }}
          remote-path: "${{ vars.REMOTE_TARGET }}/test"
          local-path: "www/test"
          sync: "full"

When sync is set to "full", we get a run like this:

Run milanmk/actions-file-deployer@1.14
  with:
    remote-host: ***
    remote-user: ***
    remote-password: ***
    remote-path: /home/***/public_html/test
    local-path: www/test
    sync: full
    remote-protocol: sftp
    remote-port: 22
    proxy: false
    proxy-port: 22
    proxy-forwarding-port: 1080
Run echo "::group::Initialization"
Initialization
  Check repository
  Initialize inputs
  Validate inputs
Install packages
  Selecting previously unselected package lftp.
  (Reading database ... 
  (Reading database ... 5%
  (Reading database ... 10%
  (Reading database ... 15%
  (Reading database ... 20%
  (Reading database ... 25%
  (Reading database ... 30%
  (Reading database ... 35%
  (Reading database ... 40%
  (Reading database ... 45%
  (Reading database ... 50%
  (Reading database ... 55%
  (Reading database ... 60%
  (Reading database ... 65%
  (Reading database ... 70%
  (Reading database ... 75%
  (Reading database ... 80%
  (Reading database ... 85%
  (Reading database ... 90%
  (Reading database ... 95%
  (Reading database ... 100%
  (Reading database ... 269551 files and directories currently installed.)
  Preparing to unpack .../lftp_4.9.2-1build1_amd64.deb ...
  Unpacking lftp (4.9.2-1build1) ...
  Setting up lftp (4.9.2-1build1) ...
  Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
  Processing triggers for hicolor-icon-theme (0.17-2) ...
  Processing triggers for man-db (2.10.2-1) ...
  NEEDRESTART-VER: 3.5
  NEEDRESTART-KCUR: 6.5.0-1021-azure
  NEEDRESTART-KEXP: 6.5.0-1021-azure
  NEEDRESTART-KSTA: 1
Configurations
  File created: /home/runner/.ssh/config
  ____________________________________________________________________________________________________
  File created: /home/runner/.netrc
  ____________________________________________________________________________________________________
  File created: ~/.lftprc
Prepare files
  Event: pull_request
  Revision: [redacted]
  Committer: wtflm
  Message: 
  ____________________________________________________________________________________________________
  File created: www/test/.deploy-revision
  1c13a790c086eaa7e000d39e2ad36f02f258e4af
  ____________________________________________________________________________________________________
Transfer files
  Protocol: sftp
  Synchronization: full
  Local path: www/test
  Remote path: /home/***/public_html/test
  ____________________________________________________________________________________________________
  put: /home/runner/work/[redacted]/.deploy-running: No such file or directory
  /home/runner/work/[redacted]/www/test/.deploy-revision -> sftp://***@***:22/home/***/public_html/test/.deploy-revision 0-41 108 B/s
  /home/runner/work/[redacted]/www/test/another.file -> sftp://***@***:22/home/***/public_html/test/another.file 0-13 34 B/s
  /home/runner/work/[redacted]/www/test/nufile -> sftp://***@***:22/home/***/public_html/test/nufile 0-4 11 B/s
  /home/runner/work/[redacted]/www/test/test.txt -> sftp://***@***:22/home/***/public_html/test/test.txt 0-0 
  /home/runner/work/[redacted]/www/test/.deploy-running -> sftp://***@***:22/home/***/public_html/test/.deploy-running 0-0 
  /home/runner/work/[redacted]/www/test/.htaccess -> sftp://***@***:22/home/***/public_html/test/.htaccess 0-0 
Cleanup
  removed '/home/runner/.netrc'
  removed '/home/runner/transfer_log.txt'
Run actions/upload-artifact@v4
  with:
    name: transfer_artifacts
    path: ~/transfer_log.txt
  ~/transfer_files

    if-no-files-found: ignore
    compression-level: 6
    overwrite: false
Multiple search paths detected. Calculating the least common ancestor of all paths
The least common ancestor is /home/runner. This will be the root directory of the artifact
No files were found with the provided path: ~/transfer_log.txt
~/transfer_files. No artifacts will be uploaded.

After adding yet.another.file to www/test and changing to sync: "delta", this happens:

Run milanmk/actions-file-deployer@1.14
  with:
    remote-host: ***
    remote-user: ***
    remote-password: ***
    remote-path: /home/***/public_html/test
    local-path: www/test
    sync: delta
    remote-protocol: sftp
    remote-port: 22
    proxy: false
    proxy-port: 22
    proxy-forwarding-port: 1080
Run echo "::group::Initialization"
Initialization
  Check repository
  Initialize inputs
  Validate inputs
Install packages
  Selecting previously unselected package lftp.
  (Reading database ... 
  (Reading database ... 5%
  (Reading database ... 10%
  (Reading database ... 15%
  (Reading database ... 20%
  (Reading database ... 25%
  (Reading database ... 30%
  (Reading database ... 35%
  (Reading database ... 40%
  (Reading database ... 45%
  (Reading database ... 50%
  (Reading database ... 55%
  (Reading database ... 60%
  (Reading database ... 65%
  (Reading database ... 70%
  (Reading database ... 75%
  (Reading database ... 80%
  (Reading database ... 85%
  (Reading database ... 90%
  (Reading database ... 95%
  (Reading database ... 100%
  (Reading database ... 269551 files and directories currently installed.)
  Preparing to unpack .../lftp_4.9.2-1build1_amd64.deb ...
  Unpacking lftp (4.9.2-1build1) ...
  Setting up lftp (4.9.2-1build1) ...
  Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
  Processing triggers for hicolor-icon-theme (0.17-2) ...
  Processing triggers for man-db (2.10.2-1) ...
  NEEDRESTART-VER: 3.5
  NEEDRESTART-KCUR: 6.5.0-1021-azure
  NEEDRESTART-KEXP: 6.5.0-1021-azure
  NEEDRESTART-KSTA: 1
Configurations
  File created: /home/runner/.ssh/config
  ____________________________________________________________________________________________________
  File created: /home/runner/.netrc
  ____________________________________________________________________________________________________
  File created: ~/.lftprc
Prepare files
  Event: pull_request
  Revision: [redacted]
  Committer: wtflm
  Message: 
  ____________________________________________________________________________________________________
  File created: www/test/.deploy-revision
  210ee121f159a4ea7a86f6c249fb6595a5c52a59
  ____________________________________________________________________________________________________
  Previous Revision: [redacted]
  ____________________________________________________________________________________________________
  File created: ~/files_to_upload
  ____________________________________________________________________________________________________
  File created: ~/files_to_delete
  ____________________________________________________________________________________________________
Transfer files
  Protocol: sftp
  Synchronization: delta
  Local path: www/test
  Remote path: /home/***/public_html/test
  Upload files: 0
  Delete files: 0
  ____________________________________________________________________________________________________
  /home/runner/work/[redacted]/www/test/.deploy-running -> sftp://***@***:22/home/***/public_html/test/.deploy-running 0-0 
  /home/runner/work/[redacted]/www/test/.deploy-revision -> sftp://***@***:22/home/***/public_html/test/.deploy-revision 0-41 68 B/s
Cleanup
  removed '/home/runner/.netrc'
  removed '/home/runner/transfer_log.txt'
Run actions/upload-artifact@v4
  with:
    name: transfer_artifacts
    path: ~/transfer_log.txt
  ~/transfer_files

    if-no-files-found: ignore
    compression-level: 6
    overwrite: false
Multiple search paths detected. Calculating the least common ancestor of all paths
The least common ancestor is /home/runner. This will be the root directory of the artifact
No files were found with the provided path: ~/transfer_log.txt
~/transfer_files. No artifacts will be uploaded.

The goal is to upload only the newly added yet.another.file but for some reason, it gets overlooked and only .deploy-revision ends up in the target directory.

milanmk commented 3 months ago

Can you please try setting the local-path to relative path (./) and try again.

wtflm commented 2 months ago

Yeah, that works.