Deploy Ghost GitHub Action

Nope, you can do whatever you want in the actions container and it won’t be persisted to git…

so you might have a workflow such as:

Compile sass
Minify css
Compile TS to JS
Minify JS

You would need to add one more step, create theme zip (Casper has this step in its gulpfile)

Then, you call the actions step that deploys the theme with the path to the zip you created

Hi @vikaspotluri123

I can’t wait to make this CI working with Ghost :slight_smile: When you say:

Then, you call the actions step that deploys the theme with the path to the zip you created

This is exactly where things are not clear for me. In my package.json, I run:

    "scripts": {
        "dev": "gulp",
        "build": "gulp build"
    },

This script creates a directory /dist with all compressed and all minified files.

My question: How does the CI know to push assets from this directory?

Thank you!

The action requires a zip file ;) You can add this command to your build step to get that done: (modified version of the screenshot in the actions repo)

zip -r theme.zip dist/

This will zip everything in the dist folder to theme.zip

The command should run after yarn build runs and before the action gets executed

Thanks for jumping in this quickly!

So to be clear, the logic is that the CI will push the file dist.zip to my ghost instance?

Yep!

Humm, this is not what I can see :-/

The CI creates a zip file for all content within the git repo (not only for my /dist dir).
Let’s follow this conversation here.

And thank you so much for your help!

For anyone that’s been following along, there’s an example here that shows how you can expand your theme’s Github workflow to include building your assets before running the theme deployment action.

2 Likes

Hi, I hope it’s alright that I add onto this thread rather than start a new one. If it’d be better for me to start a new thread I’m happy to do that as well.

I’ve been receiving this error upon trying to deploy my theme repo to my ghost server:

Error [NotFoundError]: Resource not found
at /home/runner/work/_actions/TryGhost/action-deploy-theme/v1.2.1/dist/index.js:7234:33
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async main (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.2.1/dist/index.js:1545:9) {
  name: 'NotFoundError',
  context: null,
  type: 'NotFoundError',
  details: null,
  property: null,
  help: null,
  code: null,
  id: '19b24560-59f3-11ea-b3cc-3f850d3b4f41'
}

I’ve tried deploying a previously successful commit and it was not successful this time:

You can see that the commit “Show specific tags” was successful the first attempt, but not the most recent attempt. I am able to zip up my theme and upload it directly to my server and have it work.

Does anyone have an idea on what might be causing this error?

Well, turns out it was due to a silly oversight on my part. I forgot to update my repo’s secrets after launching our site. The GH action is now working properly.

I will ask here. Does anyone know why I received this error? :man_shrugging:

Imgur

And as far as I know Ghost uses Node 12, not 10.

Excellent. I had incorrect tag-name.hbs. Gscan helped me fixed this problem. Thx @dsecareanu

Edit: it seems this is known issue yet to be solved. Error on deploy with `working-directory` parameter · Issue #71 · TryGhost/action-deploy-theme · GitHub

Hi, I followed this instruction but got this error in return.
Will anybody can help me find the solution? It seems "/home/runner/work/_actions/TryGhost/action-deploy-theme/v1/dist/index.js" caused it?

##[debug]Evaluating condition for step: 'Deploy Ghost Theme'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Deploy Ghost Theme
##[debug]Loading inputs
##[debug]Evaluating: secrets.GHOST_ADMIN_API_URL
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'GHOST_ADMIN_API_URL'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating: secrets.GHOST_ADMIN_API_KEY
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'GHOST_ADMIN_API_KEY'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Loading env
Run TryGhost/action-deploy-theme@v1
{
  "code": "MODULE_NOT_FOUND",
  "requireStack": [
    "/home/runner/work/_actions/TryGhost/action-deploy-theme/v1/dist/index.js"
  ]
}
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Deploy Ghost Theme