This is a fork of cpina
's GitHub action that adds the rsync
parameter. This lets the user specify what they want copied over and what files to ignore vs. copying the entire directory over and wiping the destination. "Rsync is a ... file copying tool".
One can learn and test Rsync commands easier with RsyncOSX by Thomas Evensen. You can duplicate a similar directory structure as your source/destination repos, add some text files, then test your commands until it does what you want to do before adding the rsync command to the GitHub workflow file.
- The only real difference here in terms of the workflow file is the additional rsync parameter where you can supply an rsync command. The rsync parameter is optional (but also the only reason you would be using this action anyways).
name: DEPLOY
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
container: ubuntu
steps:
- uses: actions/checkout@v3
- name: Pushes to another repository
id: push_directory
uses: 6notes/push-to-another-repo-with-rsync@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: 'EXAMPLE/SRC/DIRECTORY'
destination-github-username: 'USERNAME'
destination-repository-name: 'REPO_NAME'
user-email: [email protected]
target-branch: main
rsync: 'rsync --archive --verbose --delete --exclude=.git* --exclude=package*.json --exclude=node_modules --exclude=.next --exclude=README.md --stats'
See the extensive documentation in https://cpina.github.io/push-to-another-repository-docs/ (includes examples, FAQ, troubleshooting, etc.).
GitHub repository of the documentation: https://github.com/cpina/push-to-another-repository-docs