Skip to content

Commit

Permalink
Features and code improvements
Browse files Browse the repository at this point in the history
- Modified files are now added to artifacts
- Removed continue/reput option from FTP
  • Loading branch information
milanmk committed Oct 1, 2021
1 parent 996396b commit b4f32c8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
| ftp-options | no | | Additional arguments for FTP client |
| ftp-mirror-options | no | | Additional arguments for mirroring |
| webhook | no | | Send webhook event notifications |
| artifacts | no | false | Upload logs to artifacts (true, false) |
| artifacts | no | false | Upload logs/files to artifacts (true, false) |
| debug | no | false | Enable debug information (true, false) |

### Notes
Expand Down Expand Up @@ -145,13 +145,15 @@ jobs:
"revision": "da39a3ee5e6b4b0d3255bfef95601890afd80709"
}
```
- Enabling `artifacts` will upload transfer log to artifacts
- Enabling `artifacts` will upload transfer log and modified files to artifacts
- Modified files are only added for delta file synchronization
- Enabling `debug` option will output useful context, inputs, configuration file contents and transfer logs to help debug each step
- It is strongly recommended to use [Encrypted Secrets](https://docs.github.com/en/actions/reference/encrypted-secrets) to store sensitive data like passwords and private keys

## Planned features

- [x] Add transfer log to artifacts
- [x] Add modified files to artifacts
- [ ] Add steps logging to file
- [ ] Add steps log to artifacts
- [x] Trigger webhook at start and end of step runs
12 changes: 9 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ runs:
if git cat-file -t ${git_previous_commit} &>/dev/null; then
git diff --name-only --diff-filter=ACMRT ${git_previous_commit}..${{github.sha}} | grep --ignore-case --invert-match "^\.git.*" > ~/files_to_upload && echo "File created: ~/files_to_upload" && cat ~/files_to_upload && show_hr
git diff --name-only --diff-filter=D ${git_previous_commit}..${{github.sha}} | grep --ignore-case --invert-match "^\.git.*" > ~/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/
fi
else
echo "::warning::Invalid base commit for delta synchronization: ${git_previous_commit}. Please ignore if this is an initial commit or newly created branch."
fi
Expand Down Expand Up @@ -340,7 +344,7 @@ runs:
rm -f \"${remote_path_slash}.deploy-running\""
else
${proxy_cmd} lftp -c "put -O \"${remote_path_unslash}\" .deploy-running
mput -c -d -O \"${remote_path_unslash}\" .deploy-revision $(awk 'ORS=" " { print "\"" $0 "\"" }' ~/files_to_upload)
mput -d -O \"${remote_path_unslash}\" .deploy-revision $(awk 'ORS=" " { print "\"" $0 "\"" }' ~/files_to_upload)
rm -f \"${remote_path_slash}.deploy-check\" $(awk 'ORS=" " { print "\"${remote_path_slash}" $0 "\"" }' ~/files_to_delete)
rm -f \"${remote_path_slash}.deploy-running\""
fi
Expand All @@ -367,6 +371,8 @@ runs:
- name: "Upload artifacts"
uses: actions/upload-artifact@v2
with:
name: "transfer_log"
path: '~/transfer_log.txt'
name: "transfer_artifacts"
path: |
~/transfer_log.txt
~/transfer_files
if-no-files-found: ignore

0 comments on commit b4f32c8

Please sign in to comment.