Conditional path to deploy in cpanel.yml file configuration

cPanel & WHM Version
86.0.30

descabellado

Registered
Feb 9, 2021
1
0
1
Argentina
cPanel Access Level
Website Owner
I need to deploy the same repository in different paths based on the current path of this file

Example:

If this .Cpanel.yml is in the repository located at "/ home / foo / repository / foo_prod /", implement it at / home / foo / public_html / production_folder / but if the file location binder . cpanel.yml is in "/ home / foo / repository / foo_pre_prod /" so implement it in / home / foo / public_html / pre_prod_folder /

Code:
Current file .cpanel.yml

---
deployment:
  tasks:
    - export DEPLOYPATH=/home/foo/public_html/xyz/
    - /bin/cp -R * $DEPLOYPATH
--------end


idea file .cpanel.yml
---
deployment:
  tasks:
      - $FOLDER_TO_DEPLOY = (current_file_path = "/home/..../foo") ? "prod" : "pre_prod";
    - export DEPLOYPATH=/home/foo/public_html/$FOLDER_TO_DEPLOY
    - /bin/cp -R * $DEPLOYPATH
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
4,399
554
273
cPanel Access Level
Root Administrator
Hey there! I spoke with a developer that is more familiar with this type of work and he suggested creating a deploy script in the project itself, with an entry in cpanel.yml that triggers the script. Would that be an option for you?