Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


πŸš€ Coolify Deploy Action

Reusable JavaScript GitHub Action for deploying to Coolify with optional Cloudflare Bot Fight Mode bypass, post-action cleanup, GitHub Deployments, and automatic app URL resolution.

ilhmlnaa/coolify-deploy turns repeated Coolify deployment workflow patterns into a single reusable action. It can temporarily disable Cloudflare Bot Fight Mode before triggering Coolify deploy webhooks, then automatically restore it in a post: step that runs even when the job fails or is cancelled.


πŸ“‘ Table of Contents


✨ Features

  • πŸš€ Coolify Webhook Deploys
    • Trigger one or many Coolify deploy webhooks from a single workflow step.
    • Supports comma-separated and newline-separated webhook URL input.
  • πŸ›‘οΈ Cloudflare Bot Fight Mode Bypass
    • Optionally disables Bot Fight Mode before deploy.
    • Uses a JavaScript action post: step to restore Bot Fight Mode after the job.
  • 🧹 Reliable Cleanup
    • Cleanup uses post-if: always() so restoration runs on success, failure, or cancellation.
  • πŸ“¦ GitHub Deployment API
    • Optionally creates GitHub Deployment records and deployment statuses.
  • πŸ”Ž Auto App URL Resolution
    • Resolves environment_url from Coolify application fqdn via deployment UUID.
  • 🧩 Reusable Workflow Primitive
    • Designed to replace repeated deploy snippets across projects like zenime-next, askpdf-ai, and crawlix-next.

⚑ Quick Start

name: Deploy
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: ilhmlnaa/coolify-deploy@v1
        with:
          coolify_webhook_url: ${{ secrets.COOLIFY_WEBHOOK_URL }}
          coolify_token: ${{ secrets.COOLIFY_TOKEN }}

βš™οΈ Inputs

Input Required Default Description
coolify_webhook_url βœ… β€” Coolify webhook URL(s). Supports comma-separated or newline-separated values for multi-service deploys.
coolify_token βœ… β€” Coolify API Bearer token used for deploy webhook calls and optional app URL resolution.
cloudflare_api_token ❌ '' Cloudflare API token. When provided with cloudflare_zone_id, enables Bot Fight Mode bypass in auto mode.
cloudflare_zone_id ❌ '' Cloudflare Zone ID. Required when cloudflare_api_token is set.
bypass_cloudflare_bot ❌ auto true, false, or auto. auto enables bypass only when Cloudflare credentials are provided.
propagation_delay ❌ 15 Seconds to wait after disabling Bot Fight Mode before triggering Coolify deploys.
create_github_deployment ❌ false Set to true to create GitHub Deployment records.
deployment_environment ❌ production Environment name for GitHub Deployment API.
app_url ❌ '' Deployment environment URL. Use auto to resolve from Coolify API fqdn, pass an explicit URL, or leave empty.
github_token ❌ ${{ github.token }} GitHub token for Deployment API. Usually the default is enough.

πŸ“€ Outputs

Output Description
deployment_status success or failure, based on Coolify webhook results.
deployed_services Number of services successfully deployed.
bot_mode_restored true, false, skipped, or pending. The final value is emitted by the post step when available.
github_deployment_id GitHub Deployment ID if deployment creation is enabled.
resolved_app_url Resolved app URL when app_url: auto succeeds, or explicit app_url value.

πŸ§ͺ Usage Examples

Basic Deploy

- uses: ilhmlnaa/coolify-deploy@v1
  with:
    coolify_webhook_url: ${{ secrets.COOLIFY_WEBHOOK_URL }}
    coolify_token: ${{ secrets.COOLIFY_TOKEN }}

With Cloudflare Bypass

- uses: ilhmlnaa/coolify-deploy@v1
  with:
    coolify_webhook_url: ${{ secrets.COOLIFY_WEBHOOK_URL }}
    coolify_token: ${{ secrets.COOLIFY_TOKEN }}
    cloudflare_api_token: ${{ secrets.CF_API_TOKEN }}
    cloudflare_zone_id: ${{ secrets.CF_ZONE_ID }}

Multi-Service Deploy

- uses: ilhmlnaa/coolify-deploy@v1
  with:
    coolify_webhook_url: |
      ${{ secrets.API_WEBHOOK }},
      ${{ secrets.WORKER_WEBHOOK }},
      ${{ secrets.WEB_WEBHOOK }}
    coolify_token: ${{ secrets.COOLIFY_TOKEN }}

Full Featured Deploy

permissions:
  contents: read
  deployments: write

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: ilhmlnaa/coolify-deploy@v1
        with:
          coolify_webhook_url: |
            ${{ secrets.API_WEBHOOK }},
            ${{ secrets.WORKER_WEBHOOK }},
            ${{ secrets.WEB_WEBHOOK }}
          coolify_token: ${{ secrets.COOLIFY_TOKEN }}
          cloudflare_api_token: ${{ secrets.CF_API_TOKEN }}
          cloudflare_zone_id: ${{ secrets.CF_ZONE_ID }}
          create_github_deployment: 'true'
          deployment_environment: 'production'
          app_url: 'auto'

More complete workflow examples are available in examples/.


πŸ”Ž Auto App URL

When app_url is set to auto, the action extracts the Coolify instance base URL and app UUID from the first webhook URL:

https://coolify.example.com/api/v1/deploy?uuid=abc123

It then calls:

GET https://coolify.example.com/api/v1/applications/abc123

If Coolify returns:

{ "fqdn": "https://myapp.com,https://www.myapp.com" }

The action uses the first URL:

https://myapp.com

Note: Auto app URL resolution requires a Coolify token with permission to read applications. If the lookup fails, deployment still continues and the GitHub Deployment status is created without environment_url.


πŸ›‘οΈ Cloudflare Bot Fight Mode Bypass

Some Coolify deploy webhooks can be blocked when Cloudflare Bot Fight Mode is enabled in front of the Coolify instance. This action can temporarily disable Bot Fight Mode before deployment and restore it afterwards.

The lifecycle is:

  1. Read current Cloudflare Bot Fight Mode state.
  2. Disable Bot Fight Mode.
  3. Save the original state via core.saveState().
  4. Wait for propagation_delay seconds.
  5. Trigger Coolify deploy webhook(s).
  6. Run post: cleanup with post-if: always().
  7. Re-enable Bot Fight Mode only if it was originally enabled.

This means the action does not blindly enable Bot Fight Mode. It restores the original state.


πŸ“¦ GitHub Deployments

Set create_github_deployment to true to create a GitHub Deployment record and status.

permissions:
  contents: read
  deployments: write

steps:
  - uses: ilhmlnaa/coolify-deploy@v1
    with:
      coolify_webhook_url: ${{ secrets.COOLIFY_WEBHOOK_URL }}
      coolify_token: ${{ secrets.COOLIFY_TOKEN }}
      create_github_deployment: 'true'
      deployment_environment: 'production'
      app_url: 'auto'

Deployment status is set to:

  • success when all Coolify webhook calls return 2xx
  • failure when one or more webhook calls fail

πŸ” Permissions Required

GitHub Workflow Permissions

For normal deploy-only usage:

permissions:
  contents: read

For GitHub Deployment API usage:

permissions:
  contents: read
  deployments: write

Coolify Token

The Coolify token should be able to:

  • Trigger deploy webhooks.
  • Read application details if app_url: auto is used.

Cloudflare Token

For Bot Fight Mode bypass, the Cloudflare token needs permission to read and edit zone bot management settings for the target zone.

Recommended scope:

  • Zone: Read
  • Bot Management: Edit, if available for your account/plan

Cloudflare API permission names can vary by account features and plan. Use the minimum permissions that allow access to:

GET /client/v4/zones/{zone_id}/bot_management
PUT /client/v4/zones/{zone_id}/bot_management

πŸ›  Development

Install Dependencies

npm install

Build Bundled Action Files

npm run build

This creates:

dist/main/index.js
dist/post/index.js

dist/ must be committed because JavaScript GitHub Actions run from the bundled files.

Lint

npm run lint

Release

git tag v1.0.0
git push origin v1.0.0

πŸ“ Project Structure

coolify-deploy/
β”œβ”€β”€ action.yml
β”œβ”€β”€ package.json
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.js
β”‚   β”œβ”€β”€ post.js
β”‚   β”œβ”€β”€ cloudflare.js
β”‚   β”œβ”€β”€ coolify.js
β”‚   β”œβ”€β”€ deployment.js
β”‚   └── utils.js
β”œβ”€β”€ dist/
β”‚   β”œβ”€β”€ main/index.js
β”‚   └── post/index.js
β”œβ”€β”€ .github/workflows/test.yml
β”œβ”€β”€ examples/
β”‚   β”œβ”€β”€ basic.yml
β”‚   β”œβ”€β”€ with-cloudflare.yml
β”‚   β”œβ”€β”€ multi-service.yml
β”‚   └── full-featured.yml
β”œβ”€β”€ README.md
β”œβ”€β”€ LICENSE
└── .gitignore

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Deploy to Coolify with optional Cloudflare Bot Fight Mode bypass, post-action cleanup, GitHub Deployments, and automatic app URL resolution.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages