From 1361c30d691615425b6894ed2fd81b44c04f0f33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kukuczka?= Date: Sun, 30 Mar 2025 13:36:12 +0200 Subject: [PATCH] update readme --- README.md | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) diff --git a/README.md b/README.md index e69de29..6371c7a 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,124 @@ +# ๐Ÿ“‚ Prepare Remote NFS Directories Action + +Easily create and populate remote directories on your NFS-mounted server via SSH. Perfect for isolating deployments and managing static assets or configuration files! ๐Ÿš€โœจ + +--- + +## ๐ŸŒŸ Features + +- ๐Ÿ“ก **Remote Directory Creation**: Automatically creates directories on your remote NFS-mounted server. +- ๐Ÿ“‚ **Automatic File Copying**: Copies local directory contents to remote directories. +- ๐Ÿ”‘ **Secure SSH Handling**: Uses secure SSH key authentication. +- ๐Ÿ› ๏ธ **Flexible Directory Structure**: Customize remote directory paths with stack names and optional prefixes (e.g., Git SHA). +- ๐Ÿ“‹ **Detailed Debug Logs**: Clear logs for easy troubleshooting. + +--- + +## ๐Ÿ“ฅ Inputs + +| Input | Description | Required | Default | +|--------------------|---------------------------------------------------------------------|----------|---------------------------| +| `stack_name` | Stack name to prefix remote directories | โœ… Yes | - | +| `ssh_host` | SSH host of the remote server | โœ… Yes | - | +| `ssh_user` | SSH username for the remote server | โœ… Yes | - | +| `ssh_key` | SSH private key for authentication | โœ… Yes | - | +| `directories` | Newline-separated list of local directories to create remotely and copy contents from | โŒ No | *(empty)* | +| `remote_base_path` | Base path on remote server | โŒ No | `/mnt/docker-mounts` | +| `dir_prefix` | Optional prefix for remote directories (e.g., Git short SHA) | โŒ No | *(empty)* | + +**Example for `directories` input:** +``` +config +public/images +public/icons +``` + +--- + +## ๐Ÿ“ค Outputs + +| Output | Description | Example | +|------------------|-----------------------------------------------|-----------------------------------------------| +| `created_paths` | Newline-separated list of remote directories created | `/mnt/docker-mounts/my-stack/config` | + +--- + +## ๐Ÿ› ๏ธ Example Usage + +Here's how you can integrate this action into your workflow: + +```yaml +- name: Prepare Remote Directories ๐Ÿ“‚ + id: prepare-remote + uses: your-org/prepare-remote-nfs-directories@main + with: + stack_name: my-awesome-stack + ssh_host: ${{ vars.SSH_HOST }} + ssh_user: ${{ secrets.SSH_USER }} + ssh_key: ${{ secrets.SSH_KEY }} + directories: | + config + public/images + public/icons + remote_base_path: /mnt/docker-mounts + dir_prefix: ${{ github.sha }} + +- name: Show Created Directories ๐Ÿ“‹ + run: | + echo "Directories created remotely:" + echo "${{ steps.prepare-remote.outputs.created_paths }}" +``` + +--- + +## ๐Ÿง‘โ€๐Ÿ’ป How It Works + +This action performs the following steps: + +| Step | Description | +|------|-------------| +| ๐Ÿ”‘ | Securely creates a temporary SSH key file for authentication. | +| ๐Ÿ“‚ | Creates remote directories based on your inputs (`stack_name`, `dir_prefix`). | +| ๐Ÿ“ค | Copies contents from specified local directories to remote directories. | +| ๐Ÿ” | Sets appropriate permissions (`755`) on remote directories. | +| ๐Ÿงน | Cleans up temporary SSH key file after completion. | +| ๐Ÿ“‹ | Provides detailed debug logs for each step. | + +--- + +## ๐Ÿ“– Debugging & Logs + +Detailed debug logs are provided at every step, making troubleshooting easy: + +``` +DEBUG: Starting directory preparation step +DEBUG: Remote host: my.remote.host +DEBUG: Remote user: deploy-user +DEBUG: Remote base path: /mnt/docker-mounts +DEBUG: Stack name: my-stack +DEBUG: Directory prefix: 'abc1234' +DEBUG: Processing local directory: 'config' +DEBUG: Ensuring remote directory exists: '/mnt/docker-mounts/my-stack-abc1234/config' +... +DEBUG: Directory preparation step completed successfully +``` + +--- + +## โš ๏ธ Requirements + +- SSH access to your remote NFS-mounted server. +- SSH key authentication enabled. +- Local directories specified must exist and contain files you want to copy. + +--- + +## ๐Ÿ“œ License + +This action is open-source software licensed under the MIT license. + +--- + +Happy deploying! ๐ŸŽ‰ + +โ€” **Grand** \ No newline at end of file