Best laravel framework open-source packages.

Netlify deploy

Automatic Netlify builds on WordPress publish and update events.
Updated 2 months ago

Netlify Deploy 🚗💨

License: MIT Twitter: @tinydevteam

Automatic Netlify builds on WordPress publish and update events.

Features

  • Makes it super easy to keep a static frontend in sync with your post database
  • Out of the box support for configuration with .env
  • Full composer support
  • Supports custom posttypes
  • Supports custom publish hooks
  • Free & open source

Requirements

  • WordPress 5.2+
  • PHP 7.2+

Install

composer require pixelcollective/netlify-deploy

Usage

Request a webhook URL from Netlify to use to trigger builds (you can find the "Build hooks" section on your site dashboard at /settings/deploys#build-hooks).

Next, add the URL to your site .env variables and activate the plugin. Env variables are included in .env.example and below, for your reference:

## Hooks
NETLIFY_WEBHOOK_DEVELOPMENT=https://api.netlify.com/build_hooks/{yourBuildHookId}
NETLIFY_WEBHOOK_STAGING=https://api.netlify.com/build_hooks/{yourBuildHookId}
NETLIFY_WEBHOOK_PRODUCTION=https://api.netlify.com/build_hooks/{yourBuildHookId}

Filters

netlify_posttypes

By default the plugin makes a run on the provided Netlify webhook when the standard WordPress posttypes post and page undergo a change in publish status.

If you would like to modify this you can do so by passing an array of desired posttypes to the netlify_posttypes filter.

add_filter('netlify_posttypes', [
  'post',
  'page',
  'video-film',
  'brandon-small-jokes',
]);

netlify_webhooks

You can modify your webhooks at runtime using the netlify_hooks filter:

add_filter('netlify_hooks', [
  'development' => 'https://api.netlify.com/build_hooks/########',
  'testing'     => 'https://api.netlify.com/build_hooks/########',
  'production'  => 'https://api.netlify.com/build_hooks/########',
])

netlify_env_override

If you don't want to use env variables because you don't have a deployment strategy and enjoy living poorly you can hook into the netlify_env_override filter and pass the target webhook directly at runtime:

add_filter('netlify_env_override', 'https://api.netlify.com/build_hooks/########');

netlify_transitions

Change the post status transitions which trigger a build. Usage with the default values is shown below:

add_filter('netlify_transitions', [
  'draft_to_publish',
  'publish_to_draft',
  'publish_to_trash',
  'publish_to_private',
  'private_to_public',
  'new_to_publish',
]);

Author

👤 Tiny Pixel Collective, LLC

🤝 Contributing

Contributions, issues and feature requests are welcome!

🧠 ? Open a PR. Be sure to abide by our contribution guidelines.

😩 ? Open an issue.

Show your support

We need ⭐️s to live. Please.

📝 License

This project is MIT licensed.


Copyright © 2019 Tiny Pixel Collective, LLC.

Tags events php