Last active
June 5, 2023 05:01
-
-
Save mabasic/a43b7ac80ee08c04f594 to your computer and use it in GitHub Desktop.
Envoy common features with Slack notifications. See http://laravel.com/docs/5.0/envoy for more info.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@servers(['web' => '[email protected] -p 1234']) | |
@setup | |
$project_name = 'Project Name'; | |
$project_url = 'http://project-domain.com/'; | |
$project_root = '/www/project/web'; | |
$slack_hook = 'your-slack-hook-url'; | |
$slack_channel = '#channel'; | |
@endsetup | |
@task('put_app_up', ['on' => 'web']) | |
cd {{ $project_root }} | |
php artisan up | |
@endtask | |
@task('put_app_down', ['on' => 'web']) | |
cd {{ $project_root }} | |
php artisan down | |
@endtask | |
@task('pull_latest_changes', ['on' => 'web']) | |
cd {{ $project_root }} | |
git pull origin | |
@endtask | |
@task('install_dependencies', ['on' => 'web']) | |
cd {{ $project_root }} | |
composer install --prefer-source --no-interaction --no-dev | |
@endtask | |
@task('clear_cache', ['on' => 'web']) | |
cd {{ $project_root }} | |
php artisan cache:clear | |
@endtask | |
@macro('update') | |
put_app_down | |
pull_latest_changes | |
install_dependencies | |
put_app_up | |
@endmacro | |
@after | |
@slack($slack_hook, $slack_channel, "Envoy task $task ran on <$project_url|[$project_name]>") | |
@endafter |
@bigoper Maybe change "Envoy task $task ran on <$project_url|[$project_name]>"
to "Envoy task {$task} ran on <{$project_url}|[{$project_name}]>"
.
Hope it helps!
Hello, I have tried with {$task} and it does not work either. I really cant find what's wrong...
@finished worked for us
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey,
On line 50 when executing @slack, I get the slack msg, but the $task is empty...
When I run the following:
@slack('https://hooks.slack.com/services/XXXXXXXXXXXXX','#alerts')
I do get the task name in the default msg.
"demo-user ran the [testDomain] task"
Can you assist?
Thanks!