From 8c3297b4bae1f34cf50b315ef9337ea84e4f6978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kukuczka?= Date: Sun, 30 Mar 2025 13:36:07 +0200 Subject: [PATCH] update readme --- README.md | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/README.md b/README.md index e69de29..caf5e0c 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,104 @@ +# 🛠️ Prepare Deployment File Action + +Automatically process your Docker Compose or Stack deployment files by substituting placeholders with values from GitHub Action inputs, environment variables, and secrets. 🚀 + +--- + +## ✨ Features + +- 📄 **Flexible file processing**: Supports Docker Compose and Stack files. +- 🔄 **Dynamic substitutions**: Replace placeholders with inputs, environment variables, and secrets. +- 📋 **Detailed debug logs**: Clearly see each substitution step for easy troubleshooting. +- 📦 **Outputs processed file**: Ready-to-use deployment file for seamless deployments. + +--- + +## 📥 Inputs + +| Input | Description | Required | +|-----------------|--------------------------------------------------------------|----------| +| `compose_file` | Deployment file to process (e.g., `docker-compose.yml`) | ✅ Yes | +| `stack_name` | Stack name to substitute in deployment file | ✅ Yes | +| `org_name` | Organization name to substitute in deployment file | ✅ Yes | +| `repo_name` | Repository name to substitute in deployment file | ✅ Yes | +| `git_sha` | Git short SHA to substitute in deployment file | ✅ Yes | + +--- + +## 📤 Outputs + +| Output | Description | Example | +|--------------------|---------------------------------------------|---------------------------------| +| `processed_file` | Path to the processed deployment file | `docker-compose.processed.yml` | + +--- + +## 🛠️ Example Usage + +Here's how you can integrate this action into your workflow: + +```yaml +- name: Prepare Deployment File 🛠️ + id: prepare-deploy + uses: your-org/prepare-deployment-file@main + with: + compose_file: docker-compose.yml + stack_name: my-awesome-stack + org_name: my-org + repo_name: my-repo + git_sha: ${{ github.sha }} + +- name: Deploy 🚀 + run: | + echo "Deploying using processed file: ${{ steps.prepare-deploy.outputs.processed_file }}" +``` + +--- + +## 🧑‍💻 How It Works + +This action performs the following steps: + +| Step | Description | +|------|-------------| +| 📄 | Copies your original deployment file to a new processed file | +| 🔄 | Substitutes placeholders with values from `.env` file (if present) | +| 🔄 | Substitutes placeholders with GitHub Action inputs (`stack_name`, `org_name`, `repo_name`, `git_sha`) | +| 🔄 | Substitutes placeholders with environment variables and secrets available in GitHub Actions | +| 📋 | Provides detailed debug logs of each substitution step | +| 📦 | Outputs the path to the processed deployment file | + +--- + +## 📖 Debugging & Logs + +Detailed debug logs are provided at every substitution step, making troubleshooting easy: + +``` +DEBUG: Processing deployment file: docker-compose.yml +DEBUG: Found .env file. Substituting variables from .env. +DEBUG: Replacing ${MY_ENV_VAR} with value from .env +DEBUG: Replacing ${STACK_NAME} with GitHub Action input value 'my-stack' +... +DEBUG: Final processed deployment file path: +docker-compose.processed.yml +``` + +--- + +## ⚠️ Requirements + +- Your deployment file should contain placeholders in the format `${PLACEHOLDER_NAME}`. +- Optional `.env` file at the repository root for additional substitutions. + +--- + +## 📜 License + +This action is open-source software licensed under the MIT license. + +--- + +Happy deploying! 🎉 + +— **Grand** \ No newline at end of file