Forge: Deploy Script Environment Variables

James Brooks
James Brooks

We've super-charged custom deployment scripts in Laravel Forge with the addition of dynamic environment variables.

When Forge deploys your website, we will now automatically inject several environment variables within the context of your deployment. You can use these to further customize your deployments.

These variables can be used to control your deployments in ways that were not previously possible. For example, you could stop deployments if the commit message contains "wip" and if it didn't come from a manual deployment:

if [[ $FORGE_DEPLOY_MESSAGE =~ "wip" ]]; thenif [[ $FORGE_MANUAL_DEPLOY -eq 0 ]]; thenecho"WIP commits will not deploy automatically..."exit 1 fifi

All environment variables will be unloaded after a deployment and are not accessible when fetching the deploy script via the Forge API.

You can learn more at the Forge documentation.

James Brooks
James Brooks

Latest Stories

Here’s what we've been up to recently.

Request a code sample

Certified Quality. Great Prices

We use cookies to improve your experience and to help us understand how you use our site. By using this site, you accept our use of cookies. Cookie Infox