We are looking into how to incorporate the slice machine sync in our CI/CD pipeline (on Azure DevOps), combined with Prismic's feature of having multiple environments. So far we found out that there is no slice-machine cli
and that the prismic cli
does not have a feature to sync (upload) custom types and slices.
The desired development flow
Given we have the following Prismic setup:
- Production repository, with 2 additional environments
- Acceptance (staging) environment
- Testing (staging) environment
- All custom types and slice definitions live in a single GIT repository
We have a top-down content flow:
- The content flows from Production to Acceptance to Testing.
- This is done via de Prismic dashboard, manually
We would like to have a bottom-up flow for custom types and slice definitions:
- The definitions flows from Testing to Acceptance to Production
- The DTAP-flow is a common software development flow, often mandated by organisations
- Promotion of the content and slice definitions is done via a CI/CD pipeline using a cli command or script
The issue
We are investigating how to do the promotion of custom types and slice definitions via CI/CD as manually syncing from local to production via Slice Machine is undesired (risk). The recommended way seems to use the customtypes-api
, for custom types. We then have to create a script/program to use that API. Same API seems to be usable for syncing slices, which slice machine seem to as well.
It seems we are not the only one looking into this:
- Need help trying to push Slice/Document changes through CLI instead of Slicemachine
- Version and Promote custom-types/slices through different environment using CICD - #3 by samlittlefair
- Automatically push all slices
- Prismic slice machine - Automatic deployment/sync with remote repository using cli
- GitHub - ReeceM/custom-type-api: API library to interface with the Custom Types and Slices API for Prismic
Am I missing something? Are we expected to develop our own tool for syncing custom type and slice definitions to the desired environment? How does Prismic expect to use the environments in a professional CI/CD development flow?