In most situations, any build scripts should be run within your CI/CD workflow before the Pagely deployment step is reached. However, in some rare cases, you may find the need to perform actions on the server after a deployment has been run.
In this article, we'll show you how to run additional scripts after a deployment takes place when using one of Pagely's CI/CD integrations.
Prerequisites
In this article, we're going to assume that you've already set up the repository that you'll be deploying from and have a basic understanding of how to integrate a deployment step into your workflow. If not, you may want to review our articles on setting up automatic deployments for further information.
As with any workflow or website changes, we recommend testing this on a staging or development environment before performing any actions on your live site.
Creating Post-Deployment Shell Scripts
To create a script that runs after your deployment occurs, simply create a .pagely/post-deploy
directory at the root of your repository and place any post-deployment shell scripts inside it. After a deployment occurs, any scripts inside it will be automatically run from within your app's root directory.
Example Post-Deployment Shell Script File Path
/.pagely/post-deploy/example.sh
Example Post-Deployment Shell Script
#!/usr/bin/env bash
set -eu
echo "Hi"