# Deploy theme to several instances via GitHub Actions

**URL:** <https://forum.ghost.org/t/deploy-theme-to-several-instances-via-github-actions/19354>\
**Category:** Developer help\
**Created:** [January 8, 2021, 2:02pm UTC](https://forum.ghost.org/t/deploy-theme-to-several-instances-via-github-actions/19354 "2021-01-08T14:02:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![simardcasanova](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/simardcasanova/32/10976_2.png) [@simardcasanova](https://forum.ghost.org/u/simardcasanova)\
**Post date:** [January 8, 2021, 2:02pm UTC](https://forum.ghost.org/t/deploy-theme-to-several-instances-via-github-actions/19354/1 "2021-01-08T14:02:17Z")

</div>

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!

```auto
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 }}

```

---

<div class="post-metadata">

**Author:** ![daniellockyer](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/daniellockyer/32/11993_2.png) [@daniellockyer](https://forum.ghost.org/u/daniellockyer)\
**Post date:** [January 8, 2021, 2:06pm UTC](https://forum.ghost.org/t/deploy-theme-to-several-instances-via-github-actions/19354/2 "2021-01-08T14:06:14Z")

</div>

Hey @simardcasanova! 👋 Sure - you could do the following:

```auto
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 🙂

---

<div class="post-metadata">

**Author:** ![simardcasanova](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/simardcasanova/32/10976_2.png) [@simardcasanova](https://forum.ghost.org/u/simardcasanova)\
**Post date:** [January 8, 2021, 7:30pm UTC](https://forum.ghost.org/t/deploy-theme-to-several-instances-via-github-actions/19354/3 "2021-01-08T19:30:32Z")

</div>

Awesome, thank you! I will save me an awful LOT of time.

---

<div class="post-metadata">

**Author:** ![pascalandy](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/pascalandy/32/444_2.png) [@pascalandy](https://forum.ghost.org/u/pascalandy)\
**Post date:** [January 9, 2021, 3:37am UTC](https://forum.ghost.org/t/deploy-theme-to-several-instances-via-github-actions/19354/4 "2021-01-09T03:37:11Z")

</div>

Exactly, you simply re-use the same action over and over :-p

---

<div class="post-metadata">

**Author:** ![simardcasanova](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/simardcasanova/32/10976_2.png) [@simardcasanova](https://forum.ghost.org/u/simardcasanova)\
**Post date:** [February 9, 2021, 4:39pm UTC](https://forum.ghost.org/t/deploy-theme-to-several-instances-via-github-actions/19354/5 "2021-02-09T16:39:26Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![daniellockyer](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/daniellockyer/32/11993_2.png) [@daniellockyer](https://forum.ghost.org/u/daniellockyer)\
**Post date:** [February 9, 2021, 5:38pm UTC](https://forum.ghost.org/t/deploy-theme-to-several-instances-via-github-actions/19354/6 "2021-02-09T17:38:15Z")

</div>

@simardcasanova Perfect! 🎉

---

<div class="post-metadata">

**Author:** ![tedserbinski](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/tedserbinski/32/9028_2.png) [@tedserbinski](https://forum.ghost.org/u/tedserbinski)\
**Post date:** [February 13, 2021, 2:19am UTC](https://forum.ghost.org/t/deploy-theme-to-several-instances-via-github-actions/19354/7 "2021-02-13T02:19:26Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![daniellockyer](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/daniellockyer/32/11993_2.png) [@daniellockyer](https://forum.ghost.org/u/daniellockyer)\
**Post date:** [February 15, 2021, 3:49pm UTC](https://forum.ghost.org/t/deploy-theme-to-several-instances-via-github-actions/19354/8 "2021-02-15T15:49:46Z")

</div>

@tedserbinski For sure - try this (untested though):

```auto
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 }}

```
