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
64 stars 15 forks source link

"full" uses different path than "delta" #24

Closed Plagiatus closed 1 year ago

Plagiatus commented 1 year ago

After finally finding this action that works with sftp and covers all my usecases (and I love the fact that you can toggle whether to run a delta or full in a manual action) I've come across this issue:

It seems that the path is handled differently when using delta vs when using full.

I want to sync the top level folder ./datapacks in my repository with the remote folder /world/datapacks. Here is my config file:

name: Upload to FTP
on:
  push:
    branches: [ main ]
  workflow_dispatch:
    inputs:
      sync:
        description: "File synchronization ('delta' / 'full')"
        required: true
        default: delta
jobs:
  upload:
    name: Upload 🔼
    runs-on: ubuntu-latest
    steps:
      - name: Get latest code 👀
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Sync files 📁
        uses: milanmk/actions-file-deployer@1.12
        with:
          remote-protocol: "sftp"
          remote-host: ${{ secrets.ftp_server }}
          remote-port: 2022
          remote-user: ${{ secrets.ftp_username }}
          remote-password: ${{ secrets.ftp_password }}
          local-path: "./datapacks"
          remote-path: "/world/datapacks"

When using full dispatch mode the files are created correctly:

/home/runner/work/TunnelRats/TunnelRats/datapacks/mappack/pack.mcmeta -> sftp://***@***:2022/world/datapacks/mappack/pack.mcmeta

However, when using delta, the files are put into an additional subfolder (world/datapacks/datapacks instead of world/datapacks).

/home/runner/work/TunnelRats/TunnelRats/datapacks/mappack/pack.mcmeta -> sftp://***@***:2022/world/datapacks/datapacks/mappack/pack.mcmeta

Did I configure something wrong or is this an issue with the pack?

Thank you for any info in advance :)

milanmk commented 1 year ago

remote-path should be relative to the logged in SSH user's home directory. Try login normally with the SSH user and check which is the default directory and update the remote-path accordingly.

Plagiatus commented 1 year ago

Yes, the remote path is correct.
This doesn't explain why the two options behave differently, as it works as intended when changing nothing but sync from "delta" to "full".

milanmk commented 1 year ago

I can confirm that this is a bug in the script. The issue is with how git diff generates the file names and there is no straightforward way to make it work with FTP using relative paths. I am trying several options to fix this. Will keep you posted.

milanmk commented 1 year ago

This issue has been fixed in release 1.13.

Plagiatus commented 1 year ago

thank you so much, that was very quick!