Skip to content

Commit ac7ef58

Browse files
committed
Add example files on how to override action
Signed-off-by: Riddhesh Sanghvi <[email protected]>
1 parent 3e92310 commit ac7ef58

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

example/addon.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace Deployer;
4+
5+
/**
6+
* Define your custom tasks as shown below.
7+
*/
8+
desc( 'Some task' );
9+
task( 'some:task', function () {
10+
// task code here.
11+
} );
12+
13+
14+
desc( 'Some other task' );
15+
task( 'some:othertask', function () {
16+
// task code here.
17+
} );
18+
19+
/**
20+
* Update the tasks variable and add your tasks in the order where they should be.
21+
* You can also remove any tasks which you may not need.
22+
*/
23+
$tasks = [
24+
'deploy:prepare',
25+
'deploy:unlock',
26+
'deploy:lock',
27+
'deploy:release',
28+
'rsync',
29+
'wp:config',
30+
'some:task', // Adding custom task in $tasks variable.
31+
'some:othertask', // Adding custom task in $tasks variable.
32+
'cachetool:download',
33+
'deploy:shared',
34+
'deploy:symlink',
35+
'permissions:set',
36+
'opcache:reset',
37+
'core_db:update',
38+
'deploy:unlock',
39+
'cleanup',
40+
];
41+
42+
// Stop editing now. The above given tasks will be run by deploy.php of this action now.

example/addon.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
function some_custom_function() {
4+
# function logic goes here.
5+
echo 'Custom logic goes here'
6+
}
7+
8+
# Overriding the main function of `main.sh`.
9+
# This is compulsory. You can take the functions that are run
10+
# in `main.sh`'s `main` functions else condition and
11+
# add edit/remove them as well as add your function
12+
# where needed for custom deployment changes.
13+
function main() {
14+
setup_hosts_file
15+
check_branch_in_hosts_file
16+
setup_ssh_access
17+
maybe_install_node_dep
18+
maybe_run_node_build
19+
maybe_install_submodules
20+
some_custom_function # Adding the custom function in the order where needed.
21+
setup_wordpress_files
22+
deploy
23+
}
24+
25+
main

0 commit comments

Comments
 (0)