Skip to content

Hooks

Hooks are global callbacks that run around the deployment, outside the pipeline.

typescript
await defineConfig({
  // ...
  hooks: {
    async beforeDeploy({ hosts }) {
      console.log(`Deploying to ${hosts!.length} server(s)`)
    },

    async afterDeploy() {
      // notification, etc.
    },

    async beforeHostDeploy({ host }) {
      // enable maintenance mode
    },

    async afterHostDeploy({ host }) {
      // disable maintenance mode
    },
  },
})
HookWhen it runs
beforeDeployBefore deploying to all hosts
afterDeployAfter deploying to all hosts
beforeHostDeployBefore the pipeline for each host
afterHostDeployAfter the pipeline for each host (even on error)