Sharing my GitHub Action for the Reditory theme

I just installed the “Reditory” theme from @GBJsolution, and setup a GitHub Action to automate deploying to a site, so I thought I’d share it.

It assumes the entire contents of the zip file you download from themeforest (the documentation, development, demo data, etc folders) are all pushed to your repo as-is.

It builds the environment per the Reditory docs (thanks for providing great docs for all your themes), then uses the Ghost action (thanks Ghost team!) to deploy the updated zip file to the Ghost site.

You can still make changes and build locally on your machine, and then commit things when you’re ready (I added a .gitignore file for the build and dist folders). Maybe it’ll be useful for someone else too. Also, if you see any obvious ways to streamline this that’ll shave off a few seconds, I’d love to hear it - even so, it runs in under a minute.

name: Deploy Theme to Ghost
on:
  push:
    branches:
      - master

jobs:
  deploy:
    name: Deploy Theme to Ghost
    runs-on: ubuntu-18.04
    steps:
      - name: checkout master
        uses: actions/checkout@master

      - name: use node.js
        uses: actions/setup-node@v1
        with:
          node-version: 14.x
          
      - name: install dependencies and build theme
        run: |
          cd development/reditory
          npm install gulp-cli -g
          npm install
          gulp build
          gulp zip

      - name: deploy theme
        uses: TryGhost/action-deploy-theme@v1.4.1
        with:
          api-url: ${{ secrets.GHOST_ADMIN_API_URL }}
          api-key: ${{ secrets.GHOST_ADMIN_API_KEY }}
          file: development/reditory/dist/reditory.zip
2 Likes

Thanks for sharing this @grant ! I take it as a reminder that I have to set this up for more clients :-p

Since few a days, I’m doing massive Github Actions updates in the way we build Ghost. The highlights are:

  • Multi-arch build (linux/amd64, linux/arm64, linux/arm/v7)
  • Build uses cache it’s much faster now
  • Execute CI using a single build.yml file with conditions for branch edge/master
  • Better logic between jobs (pre-build / build / post-build)
  • Share variables between jobs
  • Execute commands on the cluster (via SSH)
  • Slack notifications when build is successful
  • Lighthouse audit (localhost and online)
  • Security audit (Dockle, Trivy)
  • and more :-p

3 Likes

Wow, I’ve only scratched the very tip of the iceberg! Very cool… I should make an effort to get a little more advanced with it this year.

Happy New Year!