Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

Gatsby plugin trigger deploy


The plugin provides endpoint for triggering the deployment process. The classing use case is a self hosted CMS, Drupal or Wordpress, and a gatsby site which pull data from the CMS. Now, how does the cotent authors in the site will deploy the site to Github pages, or to S3?

If you still think on a solution - you are in the correct place. The plugin expose a REST endpoint for trigger the npm run deploy command. The endpoint requires a secret key inorder to prevent from anyone to deploy your site.


npm install --save gatsby-plugin-trigger-deploy

How to use

// In your gatsby-config.js
module.exports = {
  plugins: [
      resolve: `gatsby-plugin-trigger-deploy`,
      options: {
        secretKey: 'a super secret key, maybe with emojis? 🍕',
        addressCallback: 'http://localhost/endpoint/for/notifying',

In order to trigger the deployment you’ll need to send a request similar to this:

var axios = require('axios');

var config = {
  method: 'post',
  url: 'http://localhost:8000/deploy',
  headers: { 
    'secret_key': 'a super secret key, maybe with emojis? 🍕', 

.then(function (response) {
.catch(function (error) {


  • secretKey - Required; The secret key which is required for triggering the deployment process.
  • addressCallback - Optional; If defined, the plugin will send REST request with data on the deployment process.
© 2023 Gatsby, Inc.