justinwhall / wp-buildhook-deploy

WordPress plugin to trigger build hooks and deploy your static site.
https://justinwhall.com
163 stars 28 forks source link

Error thrown without defined hook #6

Closed braco closed 5 years ago

braco commented 5 years ago

Only entered production hook

Plugin was throwing errors and breaking updates

Temporary fix: enter garbage URL for staging

AfroDevGirl commented 5 years ago

Up voting this issue, I ran into the same exact problem (no need for a staging environment so I didn't configure it). Putting in any old url for staging in the plugin setting fixes this problem.

geocine commented 5 years ago

Right this was the error I was getting https://github.com/justinwhall/littlebot-netlify/issues/3#issuecomment-467494159

justinwhall commented 5 years ago

Never intended this plugin to be used with one environment but no reason it can't be. Easy enough to add some logic here.

geocine commented 5 years ago

@justinwhall , what is the intention of the checkbox on the sidebar of the post/page ? Is it a call to action, to publish to that environment?

Or it is just an indicator to where it is published? Because I checked the code , seems like you intent the latter. However, to a user like me I expect the former.

I am asking so I know what I would do.

justinwhall commented 5 years ago

Hey @geocine - To me, both scenarios you are describing sound like the same to me :) I assume I'm not following correctly.

Here is what happens:

  1. If the checkbox is checked, at meta value is added to the post on publish. If it's state it's lbn_published_stage if it's prod, it's lbn_published_production.
  2. Later, when Gatsby builds the site we a var is passed to the build command to tell Gatsby to only build the posts(and pages) the have correct meta value. ie, DEPLOY_ENV=lbn_published_production gatsby develop would build prod posts(and pages).
justinwhall commented 5 years ago

BTW, this plugin now supports only using one build hook.