alpacon-cp-action

Copy files and directories between your local environment and remote servers in your Alpacon workspace. Supports upload and download modes, recursive directory copy, and multiple source files.

Inputs

NameDescriptionRequiredDefault
workspace-urlAlpacon workspace URLYes
api-tokenAlpacon API tokenYes
sourceSource path(s). Upload: local paths (supports multiple, one per line). Download: single remote path.Yes
target-serverTarget server nameYes
target-pathDestination path (remote for upload, local for download)Yes
modeupload or downloadNoupload
recursiveCopy directories recursivelyNofalse
usernameUsername for file ownership on the remote serverNo
groupnameGroup name for file ownership (requires username)No

Usage

Upload a file

- name: Upload config
  uses: alpacax/alpacon-cp-action@v1
  with:
    workspace-url: ${{ secrets.ALPACON_WORKSPACE_URL }}
    api-token: ${{ secrets.ALPACON_API_TOKEN }}
    source: './config.yml'
    target-server: 'prod-server'
    target-path: '/opt/myapp/config.yml'

Upload multiple files

- name: Upload multiple files
  uses: alpacax/alpacon-cp-action@v1
  with:
    workspace-url: ${{ secrets.ALPACON_WORKSPACE_URL }}
    api-token: ${{ secrets.ALPACON_API_TOKEN }}
    source: |
      ./docker-compose.yml
      ./nginx.conf
      ./.env.production
    target-server: 'prod-server'
    target-path: '/opt/myapp/'
    username: ubuntu

Upload a directory recursively

- name: Upload build artifacts
  uses: alpacax/alpacon-cp-action@v1
  with:
    workspace-url: ${{ secrets.ALPACON_WORKSPACE_URL }}
    api-token: ${{ secrets.ALPACON_API_TOKEN }}
    source: './dist/'
    target-server: 'prod-server'
    target-path: '/var/www/app/'
    recursive: true

Download a file

- name: Download logs
  uses: alpacax/alpacon-cp-action@v1
  with:
    workspace-url: ${{ secrets.ALPACON_WORKSPACE_URL }}
    api-token: ${{ secrets.ALPACON_API_TOKEN }}
    source: '/var/log/app/error.log'
    target-server: 'prod-server'
    target-path: './logs/'
    mode: download

Notes

  • Requires alpacon-setup-action to run first
  • Upload target-path: can be a file path or directory path
  • Download target-path: must be a directory path—the file is saved with its original filename
  • Multiple sources: only supported in upload mode (one path per line)
  • Download mode: supports only a single source path
  • groupname requires username to be set

See also

Resources