This GitHub Action deploys files to a remote server using rsync (deleting extraneous files from the destination directory on the remote server by default)and optionally executes remote commands after deployment.
Example usage in a workflow:
name: Deploy to Standalone Development Server
on:
push:
branches:
- develop
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy to production server
uses: alleyinteractive/action-deploy-to-server@develop
with:
server_user: 'your-server-username'
server_ip: 'your-server-ip'
ssh_private_key: ${{ secrets.SERVER_SSH_KEY }}
source_directory: './dist'
destination_directory: '/var/www/html'
exclude_list: '.git,node_modules,.env'
remote_commands: |
composer install --no-dev
php artisan migrate --force
php artisan config:cache
Specify using
with
keyword.
- Specify the username for the remote server.
- Required.
- Specify the IP address of the remote server.
- Required.
- Specify the source directory to deploy.
- Defaults to
'.'
.
- Specify the destination directory on the remote server (relative to server_user home directory, or you can use an absolute path if you begin with a
/
). - Required.
- Specify a comma-separated list of files and directories to exclude from sync. These will be written to a temporary file and passed to rsync via
--exclude-from
. - Defaults to
'.git,node_modules,.env'
.
- Specify the SSH private key for authentication.
- Required.
- Specify commands to execute on the remote server after deployment.
- Defaults to
''
.
- Determine whether to delete extraneous files from the destination directory on the remote server (rsync --delete).
- Accepts a boolean string (
'true'
or'false'
). - Defaults to
'true'
.
- Perform a dry run of the rsync command (rsync --dry-run).
- Accepts a boolean string (
'true'
or'false'
). - Defaults to
'false'
.
Please see CHANGELOG for more information on what has changed recently.
This project is actively maintained by Alley Interactive.
The GNU General Public License (GPL) license. Please see License File for more information.