| [ Web Proxy ] |
| Viewing: https://ghost.org/integrations/github/ | [Back] [Original] |
Marketplace
Professional themes, custom integrations and qualified experts
Start here New
A huge library of guides, stories, interviews and tips for success
Themes
Hundreds of beautifully designed publication templates
Help center
Get help with product features and answers to common questions.
Integrations
Connect thousands of apps and services with your website
Product updates
All the latest changes and improvements to Ghost
Experts
Get help building your site from certified Ghost developers
About us
Learn more about the people behind the platform (We're hiring!)
How to use Ghost and GitHub together
Set up simple continuous integration of your Ghost theme to deploy directly to your Ghost website with GitHub Actions. Share code snippets with GitHub Gists.
GitHub Actions allow you to build simple automation on top of any repository, including running a build command on a theme and pushing the compiled zip file to the Ghost Admin API.
In Ghost Admin, navigate to Integrations and create a new custom integration called GitHub Actions:
[github-custom-integration_hu3bc328918044c8950b03c14ae184532a_85071_1668x0_resize_q100_h2_box_3.webp]Next, copy and paste your integration details into your GitHub repository’s secrets. You can find these under Settings Secrets and variables Actions.
[github-secrets_hub68cf85b270cab31f74f5039cf79ed4c_170114_1284x0_resize_q100_h2_box_3.webp]Create one secret called GHOST_ADMIN_API_URL with the API URL from your custom integration and another secret called GHOST_ADMIN_API_KEY with the Admin API Key from your custom integration.
Last step! Copy and paste the following code into a new file in your repository under .github/workflows/deploy-theme.yml - this will automatically use the official Ghost GitHub Action from GitHub’s Marketplace:
name: Deploy Theme
on:
push:
branches:
- master
- main
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Deploy Ghost Theme
uses: TryGhost/action-deploy-theme@v1
with:
api-url: ${{ secrets.GHOST_ADMIN_API_URL }}
api-key: ${{ secrets.GHOST_ADMIN_API_KEY }}
Now, every time you push changes to your theme repository, your theme will automatically build and deploy to Ghost Admin.
Navigate to Settings Theme in Ghost Admin to make sure that the theme you’re uploading from GitHub is the currently active theme, and you should be all set!
GitHub Gists are a simple way of sharing code snippets with other developers. Once you’ve created a new public Gist, it will be available to be shared with others.
[Creating-a-Gist_hub8da29b5d9669ec306af3ac5d3174d09_181447_2060x0_resize_q100_h2_box_3.webp]To share a Gist in Ghost, locate the embed option from the dropdown in the top navigation and copy the HTML embed code to your clipboard:
[Gist-embed-code-1_hu669c0a0d6696b82e108cf9e093da1f4c_79471_1600x0_resize_q100_h2_box_3.webp]Create a new HTML block in the Ghost editor on the post you would like to embed your code snippet and paste in the embed code.
[Ghost-cards_huedc570934e065d9fb5514b16c7852436_24138_1872x0_resize_q100_h2_box_3.webp]That’s all there is to it! Ghost allows you to paste embed code directly into the HTML block to share a Gist code snippet with your readers.
This is the quickest way to embed a Gist in Ghost. If you’re using the default theme, Casper, then this will look great without further styling. For other themes, you may want to make some styling adjustments in your theme.
Here’s an example of the end result:
Power up your site even further using Zapier. If you’re already using GitHub, then you might also like some of these complimentary automations:
Last week, 29,074 brand new
publications got started with Ghost.
Today, it's your turn.
Start publishing now →| Web Proxy Viewer | New URL | Original Page |