Giter Club home page Giter Club logo

wp-webhook-netlify-deploy's Introduction

WP Webhook Netlify Deploy

Banner Image

Description

Easily deploy static sites using Wordpress and Netlify

Build Quickly and easily send webhooks to build your Netlify

Schedule Schedule daily, weekly or monthly builds

Status Check the status of your latest build to see if it was successful without even leaving Wordpress

NOTE: this plugin does not create a static version of your WordPress site. The plugin simply fires off a build request to Netlify, to rebuild your netlify hosted site (which is assumed to be pulling in WordPress data as a headless CMS).


Installation

From your WordPress dashboard

  1. Visit Plugins > Add New
  2. Search for "Deploy Webhook Button"
  3. Install plugin
  4. Activate the plugin
  5. Click on the new menu item "Deploy Netlify Webhook" and enter your site details/keys
  6. Enter enter your site_id, webhook POST address, Netlify API Key, and User-Agent
  7. Read the documentation to get started

Where do I get the field data from?

Webhook Build

  1. Visit Netlify > Site-Name > Settings > Build & Deploy
  2. Create A Build Hook (or use an existing hook)
  3. Copy The Build Hook URL into the Webhook Build URL field

Webhook Build URL

Netlify site_id

  1. Visit Netlify > Site-Name > Settings
  2. Copy APP_ID and paste into the Netlify site_id field

Netlify Site Info

Netlify API Key

  1. Visit Netlify > User Settings > Applications > Personal Access Tokens
  2. Create A Personal Access Token (or use an existing one)
  3. Copy The token and paste into the Netlify API Key field

Netlify OAuth Applications

User-Agent Site Value

  1. Visit Netlify > Site-Name > Settings
  2. Copy The Site Name and paste into the User-Agent Site Value field
  3. Add The site url in brackets to the User-Agent Site Value field
  4. Your field should look similar to this SiteNameNoSpaces (site-name-url.com)

Netlify Site Info


Scheduling Netlify Builds

Is it possible to set daily, weekly, or monthly builds. Using this plugin. Navigate to the 'Schedule Builds' settings page to select build time and date.

Consistant Scheduling

WordPress cron jobs are not 100% reliable as they are only fired when the site is visited. A little bit of work may be required to fix this.

If you have access to your hosting cPanel

  1. Add the following to your wp-config.php file - define('DISABLE_WP_CRON', true);
  2. Create a system cron

Creating a System Cron Job

  1. Log into your systems cpanel.
  2. Navigate to the Cron Jobs section - Search for "cron"
  3. Click "Cron Jobs" (If this does not show up you may not have access to this functionality)
  4. Select "Once per hour" from the common settings
  5. Add this command to the command input wget -q -O - https://your-domain.com/wp-cron.php?doing_wp_cron

If you do not have access to your cPanel

A solution to not being able to set up cPanel cron jobs is to use a third party scheduler. This ensures that at a certain time every day your WordPress cron events will fire.

  1. Set up an account with https://cron-job.org
  2. Login and navigate to "Cronjobs"
  3. Create a new cron job for https://your-domain.com/wp-cron.php?doing_wp_cron firing a minimum of once an hour every hour.

Now the Netlify hook (and all other cron jobs on your site) will run on time.


Admin Bar

A deploy button and the status badge of the last build is added to the admin bar. By default this will only be displayed to users that can manage_options.

You may allow other user roles with these three filters:

add_filter('netlify_status_capability', function() {
    return 'edit_pages';
});

add_filter('netlify_deploy_capability', function() {
    return 'edit_pages';
});

add_filter('netlify_adjust_settings_capability', function() {
    return 'edit_pages';
});

Screenshots

Main Plugin page

Developer Settings Page

User Page


Links


Changelog

View full changelog: here

wp-webhook-netlify-deploy's People

Contributors

lukethacoder avatar marijoo avatar riddla avatar robmarshall avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

wp-webhook-netlify-deploy's Issues

Trigger deploy from another plugin?

Hi, thanks for providing this great plugin. I'm wondering if there is any way of triggering a deploy from another function?

I'm running an import plugin and need to trigger a build when a new post has been added.

Admin Bar: allow other user roles

Could you please update the documentation to explain where the following code need to be added (which file and which line):

add_filter('netlify_status_capability', function() {
    return 'edit_pages';
});

add_filter('netlify_deploy_capability', function() {
    return 'edit_pages';
});

add_filter('netlify_adjust_settings_capability', function() {
    return 'edit_pages';
});

This is not obvious for people like me who are not familiar with WordPress structure.

Dashboard Widget

Add a widget to the Dashboard to display deployment status and some other goodies

Outdated documentation

Either this documentation is outdated or unclear on how to obtain a Netlify API key.

This does not exist:

Visit Netlify > OAuth Applications > Personal Access Tokens

Wish: Ability to change capability for the "Webhook Deploy" admin page

Use case: I have a project where I would like to allow users with the "editor" role to see the "Webhook Deploy" admin page and to trigger the "Build Site" command.

For this purpose, it would be useful if I as a develop could hook into a filter that changed the $capability variable in the create_plugin_settings_page() function.

In other words, adding something along the following lines in the function:

$capability = apply_filters( 'deploy_webhook_menu_capability', 'manage_options' );

With that in place, I would be able to override the capabilities with a filter:

add_filter( 'deploy_webhook_menu_capability', 'override_deploy_webhook_capability' );
function override_deploy_webhook_capability( $capability ) {
  return 'edit_others_pages';
}

Thanks :-)

Nightly/Weekly Build - WordPress Cron

I am working on a WordPress -> Gatsby site that has events, and needs re-building nightly to update which events have finished/are about to happen. I was going to create a custom plugin but found your build.

How would you feel about me adding an option that allows the user to set automatic builds based off times/schedules via the WordPress cron?

Cheers,
Rob

Header Bar Deploy in Progress Icon

Hi - Great Plugin - have been using it in production for a number of projects.

With the latest update you changed the icon once you hit the deploy site button up on the top menu bar to a circle with an exclamation mark. While understand it is meant to signify don't abuse the button - it has alarmed a couple of my clients - they though it meant an error or the site wasn't building.

Pretty small detail - but thought you might want to know!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.