Skip to content

Instantly share code, notes, and snippets.

View Sairahcaz's full-sized avatar
🏃

Zacharias Creutznacher Sairahcaz

🏃
View GitHub Profile
<?php
// if you wanna use defer in a package where it may only be optional
// or you don't know or want to mess with if defer is already supported
// also swoole compatible if you get this error:
// Symfony\Component\ErrorHandler\Error\FatalError: Uncaught Swoole\Error: API must be called in the coroutine
if (! function_exists('safeDefer')) {
/**
# SETUP #
DOMAIN=example.com
PROJECT_REPO="[email protected]:example.com/app.git"
AMOUNT_KEEP_RELEASES=5
RELEASE_NAME=$(date +%s--%Y_%m_%d--%H_%M_%S)
RELEASES_DIRECTORY=~/$DOMAIN/releases
DEPLOYMENT_DIRECTORY=$RELEASES_DIRECTORY/$RELEASE_NAME
# stop script on error signal (-e) and undefined variables (-u)