<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Norbert Hunyadi</title>
    <description>The latest articles on DEV Community by Norbert Hunyadi (@norberthnd).</description>
    <link>https://dev.to/norberthnd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F216580%2F3a2588e2-7b98-4162-8dec-021eaa338f75.jpeg</url>
      <title>DEV Community: Norbert Hunyadi</title>
      <link>https://dev.to/norberthnd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/norberthnd"/>
    <language>en</language>
    <item>
      <title>How to Deploy Your Ghost Theme with GitHub Actions</title>
      <dc:creator>Norbert Hunyadi</dc:creator>
      <pubDate>Fri, 08 Jan 2021 19:16:39 +0000</pubDate>
      <link>https://dev.to/norberthnd/how-to-deploy-your-ghost-theme-with-github-actions-4pc1</link>
      <guid>https://dev.to/norberthnd/how-to-deploy-your-ghost-theme-with-github-actions-4pc1</guid>
      <description>&lt;p&gt;The Deploy Ghost Theme GitHub action is a great tool to improve the usual workflow when it comes to updating Ghost Themes. The most common way before was changing the theme files locally, then uploading the zip manually using the Ghost Admin.&lt;/p&gt;

&lt;p&gt;But this tool is a much better way of doing theme deployment. I have been using the &lt;a href="https://github.com/marketplace/actions/deploy-ghost-theme" rel="noopener noreferrer"&gt;Deploy Ghost Theme&lt;/a&gt; GitHub Action for the last couple of months and not only it is easy to setup, but this can save you a lot of time.&lt;/p&gt;

&lt;p&gt;Let's see how you can setup this tool to automatically deploy your Ghost Theme whenever you are pushing changes to your theme repository on GitHub.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add Custom Ghost Integration
&lt;/h2&gt;

&lt;p&gt;First step is creating a new Custom Integration in &lt;strong&gt;Ghost Admin &amp;gt; Integrations&lt;/strong&gt;. Name your integration, then press &lt;code&gt;Create&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbironthemes.com%2Fstatic%2Fd8f0d6123fee06aab3ddbdc986f7afcd%2Fdadad%2Fintegrations-custom.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbironthemes.com%2Fstatic%2Fd8f0d6123fee06aab3ddbdc986f7afcd%2Fdadad%2Fintegrations-custom.png" title="Ghost Admin Custom Integration" alt="Ghost Admin Custom Integration"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will generate the &lt;code&gt;Admin API Key&lt;/code&gt; and &lt;code&gt;Api URL&lt;/code&gt; that will be used in the next step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add GitHub Repo Secrets
&lt;/h2&gt;

&lt;p&gt;Now, go to your theme repo on Github and go to &lt;strong&gt;Settings &amp;gt; Secrets&lt;/strong&gt; Create two new secrets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;GHOST_ADMIN_API_KEY&lt;/code&gt; - use the Custom Integration value &lt;strong&gt;Admin API Key&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;GHOST_ADMIN_API_URL&lt;/code&gt; - use the Custom Integration value &lt;strong&gt;Api URL&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbironthemes.com%2Fstatic%2Ff34ceccf9ce21fabe4bdd741345ed3bf%2Fdadad%2Fgithub-secrets-ghost.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbironthemes.com%2Fstatic%2Ff34ceccf9ce21fabe4bdd741345ed3bf%2Fdadad%2Fgithub-secrets-ghost.png" title="Github Secrets Ghost CMS" alt="Github Secrets Ghost CMS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Add GitHub Deploy Config
&lt;/h2&gt;

&lt;p&gt;Once the Custom Integration and the GitHub Secrets are in place you have to add the config file which contains the basic configuration.&lt;/p&gt;

&lt;p&gt;Copy and paste the following code into &lt;code&gt;.github/workflows/deploy-theme.yml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deploy Theme&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;   
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;master&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;main&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;deploy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-18.04&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deploy Ghost Theme&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;TryGhost/action-deploy-theme@v1.4.1&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;api-url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GHOST_ADMIN_API_URL }}&lt;/span&gt;
          &lt;span class="na"&gt;api-key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GHOST_ADMIN_API_KEY }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This configuration will trigger a deployment for every commit which is pushed to the master branch. You have the possibility to customize the "on" trigger to different branches, pull requests or more. To find out more, check out the official &lt;a href="https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#on" rel="noopener noreferrer"&gt;GitHub Action Documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Besides the &lt;code&gt;api-url&lt;/code&gt; and &lt;code&gt;api-key&lt;/code&gt; there are additional config options available:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;exclude&lt;/code&gt; - list files &amp;amp; folder you would like to exclude (defaults: gulpfile.js and dist/* )&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;theme-name&lt;/code&gt; - use this to override the theme-name set in package.json&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;file&lt;/code&gt; - specify path to a built zip file (exclude and theme-name will be ignored)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is it, now when you push a new commit to your repository, the deploy should be triggered, updating your theme.&lt;/p&gt;

</description>
      <category>ghost</category>
      <category>cms</category>
      <category>ghosttheme</category>
      <category>deploy</category>
    </item>
  </channel>
</rss>
