-
-
Notifications
You must be signed in to change notification settings - Fork 591
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_URLcontaining the API URL and another calledGHOST_ADMIN_API_KEYcontaining the Admin API Key. Both must be copied exactly from Ghost Admin»Integrations. -
Create a file
.github/workflows/deploy-theme.ymlwith 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.exampleto.env -
Enter your
GHOST_ADMIN_API_URLandGHOST_ADMIN_API_KEYin the.envfile (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 deployin thesrcdirectory