This addon provides integration with Netlify deploys mechanism, leveraging the Netlify REST API to retrieve list of latest deploys and build hooks to trigger a new deploy. The addon can be useful when combining Cockpit CMS with an static site generator hosted on Netlify, so changes on contents can be deployed easily in seconds.
- Confirm that you have Cockpit CMS (Next branch) installed and working.
- Download zip and extract to 'your-cockpit-docroot/addons' (e.g. cockpitcms/addons/Netlify, the addon folder name must be Netlify)
- Confirm that the Netlify deploys icon appears on the top right modules menu.
- Ensure that from your Netlify account you have an access token and a build hook url.
- Edit Cockpit config/config.yaml and add a new entry for netlify like below:
netlify:
build_hook_url: https://api.netlify.com/build_hooks/<hook_id>
api_url: https://api.netlify.com/api/v1
site_id: <site-id>
access_token: <access-token>
branch: <branch-name>
limit: 10
Branch is optional, if provided API will return only deploys for that branch. Limit is optional, if not provided it will be used a default of 50 and it is used for the number of builds to retrieve (in some cases a long number can result in timeout).
There are just two permissions:
- manage.view - provides access to the Netlify deploy list
- manage.deploy - provides access to trigger a new deploy
Having the configuration defined accessing the Netlify deploys page (/netlify/deploys) a list of latest (limited to 50) deploys is displayed:
To trigger a new deploy just hist the Deploy button an confirm the action.
Copyright 2018 pauloamgomes under the MIT license.