There are many instances where a development team, at least my team, want a smooth development to production pipeline with a version tracked theme. Manually, this is possible with Git and Plone Theme Uploader, which developer would pull the latest changes and execute the upload command or upload the theme via the theme control panel. The problem is, someone has to do it from the command line or manually zip it and upload it.
The Big Picture
- A developer pushes the changes for the theme to the git repository.
- The CI / CD tests the changes or other developers review the changes.
- Once approved by other developers or the CI / CD, the changes merged into master.
- Once merged, the lead developer can deploy the changes to the plone site by creating a new tag.
- Create a private gitlab variable by going to your CI / CD settings (https://gitlab.com//settings/ci_cd)
- Expand the variable collapsed content, and enter your plonekey has the key and the content of .plonetheme-upload-cookie has the value. Afterwards, click save variables.
- In your gitlab-ci.yml file, located in the root of your repository, add the following lines of code:
image: node:latest deploy_theme: stage: deploy script: - sed -i "s/title = [[Title of your theme]]/title = [[Title of your theme]] $CI_COMMIT_REF_NAME/g" manifest.cfg - cat manifest.cfg - echo $plonekey > ../.plonetheme-upload-cookie - npm install -g bower - bower install --allow-root - cd .. - npm install -g plonetheme-upload - plonetheme-upload --enable [[namespace-your-theme]] [[url-for-your-plone-site]] only: - tags
For more information, visit https://jamaicandevelopers.com/Members/oshanebailey/automate-plone-theme-upload-with-gitlab