Skip to content

recipes/rsync

View source on GitHub

typescript
import '@catapultjs/deploy/recipes/rsync'

Tasks

TaskInsertedDescription
deploy:update_codeOverrides the built-in task and syncs a local directory into releases/<release>/ via rsync

Configuration

KeyTypeDefaultDescription
rsync_source_pathstring./Local source directory. A trailing slash is added automatically so only the directory contents are transferred
source_pathstringFallback source directory if rsync_source_path is not set
rsync_excludesstring[][]Patterns passed to --exclude

The recipe always syncs to the new release directory and always uses --delete.

Build locally, then sync only generated artifacts:

typescript
import { defineConfig, set } from '@catapultjs/deploy'
import '@catapultjs/deploy/recipes/rsync'

set('rsync_source_path', './dist')
set('rsync_excludes', ['.env'])

export default defineConfig({
  hosts: [
    {
      name: 'production',
      ssh: 'deploy@example.com',
      deployPath: '/home/deploy/myapp',
    },
  ],
})

Or reuse the generic source_path key:

typescript
import { defineConfig, set } from '@catapultjs/deploy'
import '@catapultjs/deploy/recipes/rsync'

set('source_path', './build')

export default defineConfig({
  hosts: [
    {
      name: 'production',
      ssh: 'deploy@example.com',
      deployPath: '/home/deploy/myapp',
    },
  ],
})