-
-
Notifications
You must be signed in to change notification settings - Fork 604
Github Action Deployment
First of all thanks to D3473R for this! 🙏🏼 This page contains basically the instructions he wrote in his PR.
Thanks to GitHub Actions you can build and deploy this theme automatically to your Ghost instance when you push to master
. Here's how you can do it:
-
Generate a set of Ghost Admin API credentials, by configuring a new Custom Integration in Ghost Admin»Integrations.
-
On GitHub, navigate to your theme repository»Settings»Secrets. Create a secret called
GHOST_ADMIN_API_URL
containing the API URL and another calledGHOST_ADMIN_API_KEY
containing the Admin API Key. Both must be copied exactly from Ghost Admin»Integrations. -
Create a file
.github/workflows/deploy-theme.yml
with the contents:
name: Deploy Theme
on: [push]
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v1
with:
node-version: '10.x'
- run: npm install
working-directory: ./src
- name: Build and deploy the theme
working-directory: ./src
run: npm run deploy
env:
GHOST_ADMIN_API_URL: ${{ secrets.GHOST_ADMIN_API_URL }}
GHOST_ADMIN_API_KEY: ${{ secrets.GHOST_ADMIN_API_KEY }}
You're all set! From now on when you push to master
the theme will be built and deployed automatically to your ghost instance 🚀
Manual deployment is also possible:
-
Copy
.env.example
to.env
-
Enter your
GHOST_ADMIN_API_URL
andGHOST_ADMIN_API_KEY
in the.env
file (Not in the .env.example file!!! Because this file is tracked with git and your secrets would be uploaded to your git repo) -
Run
npm run deploy
in thesrc
directory