Copy files and directories between your local machine and a remote server in your Alpacon workspace using the alpacon cp command in GitHub Actions.
Official Docs: alpacon cp
- Upload files or folders to a remote server
- Download files or folders from a remote server
- Supports recursive copy, user/group options, and multiple files
- Download target-path: Must be a directory path (e.g.,
./,./data/). The file will be saved with its original filename. - Upload target-path: Can be either a specific file path or directory path.
- Recursive operations: Use
recursive: truefor directory operations.
This action requires the Alpacon CLI to be installed in your workflow. Use the Alpacon Setup Action first:
- name: Setup Alpacon CLI
uses: alpacax/[email protected]- name: Upload File
uses: alpacax/[email protected]
with:
workspace-url: ${{ secrets.ALPACON_WORKSPACE_URL }}
api-token: ${{ secrets.ALPACON_API_TOKEN }}
source: './data/file.txt'
target-server: 'worker1'
target-path: '/data/file.txt'
username: ubuntu- name: Download File
uses: alpacax/[email protected]
with:
workspace-url: ${{ secrets.ALPACON_WORKSPACE_URL }}
api-token: ${{ secrets.ALPACON_API_TOKEN }}
source: '/data/file.txt'
target-server: 'worker1'
target-path: './data/' # Directory path - file will be saved as './data/file.txt'
mode: download
username: ubuntu- name: Upload Directory
uses: alpacax/[email protected]
with:
workspace-url: ${{ secrets.ALPACON_WORKSPACE_URL }}
api-token: ${{ secrets.ALPACON_API_TOKEN }}
source: './data/'
target-server: 'worker1'
target-path: '/data/'
recursive: true
username: ubuntu- name: Download Directory
uses: alpacax/[email protected]
with:
workspace-url: ${{ secrets.ALPACON_WORKSPACE_URL }}
api-token: ${{ secrets.ALPACON_API_TOKEN }}
source: '/data/'
target-server: 'worker1'
target-path: './data/'
mode: download
recursive: true
username: ubuntu| Name | Description | Required |
|---|---|---|
| workspace-url | Alpacon workspace URL. | Yes |
| api-token | Alpacon API token for authentication. | Yes |
| source | Path to upload (local) or download (remote). | Yes |
| target-server | Target server name. | Yes |
| target-path | Destination path (remote for upload, local for download). | Yes |
| mode | "upload" (default) or "download". | No |
| recursive | Set to true to copy directories recursively. | No |
| username | Username for server authentication (optional). | No |
| groupname | Group name for server authentication (optional). | No |
- For upload:
sourceis a local path,target-pathis the remote destination - For download:
sourceis a remote path,target-pathis the local destination - To copy multiple files, provide an array to
source - See the alpacon cp documentation for advanced usage