From 58030c10c50a8577d08cef33e47c23bcbbf78c33 Mon Sep 17 00:00:00 2001 From: Milan Kaneria Date: Fri, 24 Jun 2022 09:22:10 +0530 Subject: [PATCH] Feature release - Ability to exclude files from delta sync --- README.md | 10 +++++----- action.yml | 7 +++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6a76cd7..8e912bf 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ This is a composite GitHub Action (Linux runner) for deploying repository conten ```yml - name: "Checkout" - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: "Deploy" @@ -61,7 +61,7 @@ jobs: timeout-minutes: 30 steps: - name: "Checkout" - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: "Deploy" @@ -93,6 +93,7 @@ jobs: | local-path | yes | . | Local path to repository | | remote-path | yes | . | Remote path on host | | sync | yes | delta | File synchronization (delta, full) | +| sync-delta-excludes | no | | Files to exclude from delta sync | | ssh-options | no | | Additional arguments for SSH client | | ftp-options | no | | Additional arguments for FTP client | | ftp-mirror-options | no | | Additional arguments for mirroring | @@ -113,10 +114,9 @@ jobs: - `full`: Transfer all files (upload) - Does not delete files on remote host - Default glob exclude pattern is `.git*/` +- `sync-delta-excludes` accepts [pathspec](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec) patterns to exclude files from delta sync. - For `ftp-options` and `ftp-mirror-options` command arguments please refer to [LFTP manual](https://lftp.yar.ru/lftp-man.html) -- `ftp-post-sync-commands` can be used to run additional LFTP commands after the - synchronization. For example, to upload a file watched by a process manager - on the server in order to restart a deamon: +- `ftp-post-sync-commands` can be used to run additional LFTP commands after the synchronization. For example, to upload a file watched by a process manager on the server in order to restart a deamon: ``` ftp-post-sync-commands: | !touch watched_file diff --git a/action.yml b/action.yml index 1469a91..290180f 100644 --- a/action.yml +++ b/action.yml @@ -61,6 +61,9 @@ inputs: description: "File synchronization (delta, full)" required: true default: "delta" + sync-delta-excludes: + description: "Files to exclude from delta sync" + required: false ssh-options: description: "Additional command arguments for SSH client" required: false @@ -313,8 +316,8 @@ runs: # show_hr if git cat-file -t ${git_previous_commit} &>/dev/null; then - git diff --name-only --diff-filter=ACMRT ${git_previous_commit}..${{github.sha}} ':!/.git*' > ~/files_to_upload && echo "File created: ~/files_to_upload" && cat ~/files_to_upload && show_hr - git diff-tree --diff-filter=D --name-only -t ${git_previous_commit}..${{github.sha}} ':!/.git*' > ~/files_to_delete && echo "File created: ~/files_to_delete" && cat ~/files_to_delete && show_hr + git diff --name-only --diff-filter=ACMRT ${git_previous_commit}..${{github.sha}} ':!/.git*' ${{inputs.sync-delta-excludes}} > ~/files_to_upload && echo "File created: ~/files_to_upload" && cat ~/files_to_upload && show_hr + git diff-tree --diff-filter=D --name-only -t ${git_previous_commit}..${{github.sha}} ':!/.git*' ${{inputs.sync-delta-excludes}} > ~/files_to_delete && echo "File created: ~/files_to_delete" && cat ~/files_to_delete && show_hr if [ "${{inputs.artifacts}}" == "true" ]; then echo "Copy transfer artifacts" && mkdir ~/transfer_files && rsync --verbose --files-from=$HOME/files_to_upload . ~/transfer_files/