Hi everyone,
I wonder if it is possible to deploy a theme with Github Actions to several Ghost instances?
I’m not really familiar with Github Actions, but I’m guessing it would be possible to change the GA file to add multiple instances and/or deployments?
Any idea would help, thanks!
name: Deploy Theme
on:
push:
branches:
- master
- main
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Deploy Ghost Theme
uses: TryGhost/action-deploy-theme@v1.4.0
with:
api-url: ${{ secrets.GHOST_ADMIN_API_URL }}
api-key: ${{ secrets.GHOST_ADMIN_API_KEY }}
Hey @simardcasanova! Sure - you could do the following:
name: Deploy Theme
on:
push:
branches:
- master
- main
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Deploy to site X
uses: TryGhost/action-deploy-theme@v1.4.1
with:
api-url: ${{ secrets.SITE_X_ADMIN_API_URL }}
api-key: ${{ secrets.SITE_X_ADMIN_API_KEY }}
- name: Deploy to site Y
uses: TryGhost/action-deploy-theme@v1.4.1
with:
api-url: ${{ secrets.SITE_Y_ADMIN_API_URL }}
api-key: ${{ secrets.SITE_Y_ADMIN_API_KEY }}
and be sure to add your secrets in GitHub
4 Likes
Awesome, thank you! I will save me an awful LOT of time.
1 Like
Exactly, you simply re-use the same action over and over :-p
1 Like
Hi,
so the solution you offered is now in place, and it works like a charm! I am indeed saving a lot of time with this!
Hi, could this be configured to deploy different branches to different locations?
I want to be able to push changes to my “dev” branch and have it goto my dev server. And pushes to main/master goto production.
Not quite sure how to make that change?
@tedserbinski For sure - try this (untested though):
name: Deploy Theme
on:
push:
branches:
- dev
- main
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Deploy to production site
if: github.ref == 'refs/heads/main'
uses: TryGhost/action-deploy-theme@v1.4.1
with:
api-url: ${{ secrets.SITE_X_ADMIN_API_URL }}
api-key: ${{ secrets.SITE_X_ADMIN_API_KEY }}
- name: Deploy to staging site
if: github.ref == 'refs/heads/dev'
uses: TryGhost/action-deploy-theme@v1.4.1
with:
api-url: ${{ secrets.SITE_Y_ADMIN_API_URL }}
api-key: ${{ secrets.SITE_Y_ADMIN_API_KEY }}
2 Likes