The Deploy Ghost Theme GitHub action simplifies the process of updating Ghost Themes. Previously, users had to modify the theme files locally and then upload the zip file manually through the Ghost Admin. This is very time-consuming work for developers and, it's very dull work for a developer.

The GitHub action automatically deploys ghost theme whenever you push a new update to your repository's main branch, saving you time from manual uploads. To set up this tool for automatic deployment, create a new Custom Integration in your Ghost Admin and check the theme deployment actions list in your GitHub repository's Settings > Actions section.

Add Custom Ghost Integration

First, you must create a new Custom Integration in Ghost Admin → Integrations. You can give the new integration a new name, then press Create.

deploy ghost theme

This will generate the Admin API Key and API URL which will be the next step.

Add GitHub Repo Secrets

Now, go to your theme repo on GitHub and click Settings > Secrets. Create two new secrets:

  • GHOST_ADMIN_API_KEY - use the Custom Integration value Admin API Key

  • GHOST_ADMIN_API_URL - use the Custom Integration value Api URL

github secrets ghost

Add the GitHub Deployment Config File

Once the Custom Integration and GitHub Secrets are in place, the config file with the basic setup must be added. Copy and paste the code below into.github/workflows/deploy-theme.yml.

name: Deploy Ghost Theme

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: TryGhost/action-deploy-theme@v3
      with:
        api-url: ${{ secrets.GHOST_API_URL }}
        api-key: ${{ secrets.GHOST_API_KEY }}
        theme-zip: dist/your-theme-name.zip

Now, you can easily perform your first theme deployment test. Whenever you push a new commit to your repository's main branch, your theme will be automatically deployed.

To Sum Up

By configuring this setup, any commit that is pushed to the master branch will initiate a deployment. Additionally, you can tailor the "on" trigger to various branches, pull requests, or other options as per your preference. For further details, please visit the official GitHub Action Documentation. To get further information about ghost cms, then you can visit the official blog site here- themeix.com.