How to configure staging environment webhook?

Good afternoon guys.

I’m having trouble configuring a Staging environment in my project. The documentation says that I should change the initPlasmicLoader, adding the parameter preview: process.env.DEPLOY_ENVIRONMENT === ‘staging’, add DEPLOY_ENVIRONMENT to the environment variables, and add a second webhook, similar to the production one.

https://docs.plasmic.app/learn/publishing/#deploy-to-a-staging-environment

But I’m not finding the mentioned Webhook.

What’s not clear to me is, is the mentioned Webhook a configuration that happens in the repository settings, on Github?

Or do I have to make a change to the “.github/workflows/plasmic-push.yml” file to have this second webhook?

so you already have a CI/CD pipeline for publishing to prod right?

you probably need a second one specific to staging. I assume you’d want staging to show up at a different URL etc.

Exactly.

in that second pipeline, you’ll want to set the appropriate environment variables (e.g DEPLOY_ENVIRONMENT= ‘staging’)

then in Plasmic Studio, in the publish popup box, we just mean you’ll want to add a second webhook to trigger that new staging pipeline

does that make sense?

the second pipeline will need to be defined in code (e.g. in your .github/workflows/ directory if using GitHub actions)

It does make sense.

But should I create a second file, besides the ones that Plasmic created (plasmic-push.yml and plasmic.yml), containing this new Pipeline?

Or would it be in the same file Plasmic created?

right, so that’s specific to GitHub actions
https://docs.github.com/en/actions/using-workflows/about-workflows#triggering-a-workflow

you’ll want to create a separate workflow for staging, configured as mentioned above.

FWIW, GitHub actions is really powerful and flexible, but it also makes it more complicated to configure.

If you just want to publish a website, might I suggest setting up Vercel with your GitHub repo?
https://vercel.com/

It’s streamlined for building and deploying webpages, so you can just create 2 projects via their web app. And trigger them via the respective webhook. (Instead of writing GitHub workflow files)

Thank you very much for your help, Raymond. I will see more about Vercel.