Deployments and automation

Overview

At Plasmic, one of our core goals is to be flexible enough to fit into any development environment. Deployment processes and automation are a critical part of that. A start-up may want to move fast and let editors publish directly to production. An established business may want to deploy to a staging environment first, and later promote to production. We’ve built our webhooks and automation to handle any team’s requirements.

In this page, we’ll go over how to integrate Plasmic’s publish actions into your deployment systems.

Prerequisites

First, integrate Plasmic into your code. If you haven’t already, refer to our developer quickstart to get started.

Second, make sure your code is ready to be deployed on your provider. We’ve provided a quickstart instructions for Vercel and Netlify.

Vercel and GitHub quickstart

  1. Sign up or login to Vercel with GitHub.
  2. Click “Add New…” and select “Project”.
  3. Import your Plasmic-powered GitHub repository.

Netlify and GitHub quickstart

  1. Sign up or login to Netlify.
  2. Click “Add new site” and select “Import an existing project”.
  3. Import your Plasmic-powered GitHub repository.

Once your build can fetch Plasmic content and deploy successfully, you’re ready to set up automation for continuous deployment. Scroll down to the relevant section depending on whether you’re using the Headless API or Codegen.

Headless API

When you use the Headless API, your Plasmic content is usually fetched at build-time and cached for lightning-fast initial pages loads. Therefore, to deploy updates from Plasmic, you need to trigger a re-deploy on your deployment platform.

We’ll be using webhooks to trigger a re-deploy when an editor publishes your project. Most deployment platforms already provide webhooks for triggering re-deploys. If your deployment platform doesn’t, you can still build custom automation to enable this behavior.

The setup, regardless of which deployment platform you use, generally looks like this:

  1. On your deployment platform, create a webhook. Here are links to webhook documentation for some popular deployment platforms:
  2. Copy the webhook URL and paste it into Plasmic Studio. Make sure to select the correct HTTP method (usually POST).

From now on, every Plasmic publish will trigger a re-deploy and fetch the latest Plasmic content.

For more details and advanced usage such as deploying without publishing, check out the webhooks page.

Codegen

When you use Codegen, your code is the source-of-truth for your Plasmic content. Therefore, to deploy updates from Plasmic, you need to update the Plasmic-generated code (plasmic sync) on the branch your deployment platform is checking for changes on.

We’ll be using the Push to GitHub publish action to trigger plasmic sync. You can configure the publish action to either:

  • Push the changes directly
  • Submit a pull request for the changes

For more details and advanced usage, check out the Push to GitHub publish action page.

Custom automation

If the above setups don’t work for your use case, you can build your own automation by exposing a webhook on your own server to perform custom actions. Then, configure the webhooks publish action to call your server’s webhook.

Was this page helpful?

Have feedback on this page? Let us know on our forum.