Sanity Studio Dashboard Widget for triggering Now.sh deployments.
To get dashboard support in Sanity Studio in general:
sanity install @sanity/dashboard
sanity install sanity-plugin-dashboard-widget-now
- Implement your own dashboardConfig. In your
sanity.json
file, append the following line to theparts
array:
{
"implements": "part:@sanity/dashboard/config",
"path": "src/dashboardConfig.js"
}
- Create the file
src/dashboardConfig.js
and include thenow
widget config like this:
export default {
widgets: [
{
name: 'now',
options: {
nowConfig: {
// https://zeit.co/account/tokens
token: '___TOKEN___',
// https://zeit.co/docs/v2/more/deploy-hooks
deployHook: '___DEPLOY_HOOK___',
// https://zeit.co/docs/api?query=tokens#endpoints/teams/list-all-your-teams
teamId: '___TEAM_ID___',
// https://zeit.co/docs/api?query=tokens#endpoints/projects/get-all-projects
projectId: '___PROJETC_ID___'
}
}
}
]
}
token
- These tokens allow other apps to control your whole account. Be careful!deployHook
- Deploy Hooks allow you to create URLs that accept HTTP POST requests in order to trigger deployments and re-run the Build Step (https://zeit.co/docs/v2/build-step).teamId
- List deployments of the team matching the specifiedteamId
. You can getteamId
by using the teams endpoint (https://zeit.co/docs/api?query=tokens#endpoints/teams/list-all-your-teams) and obtaining the id of a team.projectId
- Filter deployments from the givenprojectId
.