pixelcollective/netlify-deploy

Fund package maintenance!
Patreon

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 68

Watchers: 4

Forks: 4

Open Issues: 2

Type:wordpress-plugin

0.0.6 2019-06-26 06:27 UTC

This package is auto-updated.

Last update: 2024-04-15 05:49:44 UTC


README

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d76302e302e362d626c75652e7376673f63616368655365636f6e64733d32353932303030 License: MIT 68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706978656c636f6c6c6563746976652f6e65746c6966792d6465706c6f792e7376673f636f6c6f723d707572706c652d626c7565267374796c653d666c61742d737175617265 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4368616e67656c6f672d547279696e672d6c69676874677265792e737667 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.