2 min read

How to deploy Ghost theme using Github actions

Ghost CMS is a modern publishing platform built on nodejs. If you are building a theme for your Ghost CMS site and want it to be deployed by itself  then Deploy Ghost Theme is here for you. It reduces the effort of editing locally and uploading the zipped theme file to the Ghost admin site every time you make any changes to your theme files.

Even for my own blog, I'm using it. I have create the blog-theme by cloning the very popular edition theme. It comes with workflow file and I just had to set the secrets. You can create the .github/workflows/deploy-theme.yml file for your custom theme.

Step 1: Create workflow file.

name: Deploy Theme
      - main
    runs-on: ubuntu-18.04
      - uses: actions/checkout@v2
      - name: Deploy Ghost Theme
        uses: TryGhost/action-deploy-theme@v1.4.1
          api-url: ${{ secrets.GHOST_ADMIN_API_URL }}
          api-key: ${{ secrets.GHOST_ADMIN_API_KEY }}

Step 2: Create custom Ghost integration

Create the integration in your Ghost site by following Ghost Admin > Integrations from the navigation. Give it a name and save it.

Create custom integration from Ghost CMS admin panel.

This will generate the API_KEY and the API_URL which will be configured in Github secrets in next step.

Step 3: Add secrets to Github

Navigate to Settings > Secrets on your theme's github repository and create 2 repository secrets.

Create secret for github repo

Create secret for API Key:

  • Value: <generated value from step2>

Create secret for API URL:

  • Value: <generated value from step2>

And your action is ready to deploy the theme on every commit on main branch to your Ghost site.

You can also configure the theme-name if having different than in package.json along with api-key and api-url config.