Adds a publish button to Nova to deploy your website to Netlify
- Laravel Nova
- A Netlify account
Install package
composer require grrr/nova-netlify-deploy
For older Nova use grrr/nova-netlify-deploy:^1.0
.
Load the tool by adding it to NovaServiceProvider.php
use Grrr\NetlifyDeploy\NetlifyDeployTool;
...
/**
* Get the tools that should be listed in the Nova sidebar.
*
* @return array<Tool>
*/
public function tools()
{
return [new NetlifyDeployTool()];
}
...
Publish configuration
php artisan vendor:publish --provider="Grrr\NetlifyDeploy\NetlifyDeployServiceProvider"
Add your Netlify credentials to the config file. You can use environment variables for this:
NETLIFY_ACCESS_TOKEN
Used to connect with the Netlify API.
Create a new token here: https://app.netlify.com/user/applications/personalNETLIFY_SITE_ID
This is the site you wish to deploy from the CMS.
You can find this under Site Settings, listed under Site information as API ID.
If you want, you can use the card provided by this package to show the deploy status on your Nova dashboard.
Include the card in the cards
array of your NovaServiceProvider
:
use Grrr\NetlifyDeploy\NetlifyDeployCard;
protected function cards()
{
return [new NetlifyDeployCard()];
}
This package broadcasts a PublicationWasStarted
event right before the Netlify API has been instructed to create a new deploy.
You can listen to this in your application if you have a need.