Giter VIP home page Giter VIP logo

action-deploy-theme's Introduction

Ghost

Deploy your Ghost Theme from GitHub

View Action Contributors Issues OpenCollective

This GitHub action allows you to automatically build and deploy your Ghost Theme
from GitHub to any Ghost install, via the Ghost Admin API!


Β 

Getting Started

πŸ’‘ This action expects that you already have a working Ghost install running at least v2.25.5.

  1. Generate a set of Ghost Admin API credentials, by configuring a new Custom Integration in Ghost Admin β†’ Integrations.

  2. On GitHub, navigate to your theme repository β†’ Settings β†’ Secrets and variables β†’ Actions. Create a secret called GHOST_ADMIN_API_URL containing the API URL and another one called GHOST_ADMIN_API_KEY containing the Admin API Key. Both must be copied exactly from Ghost Admin β†’ Integrations.

  3. Once your secrets are in place, copy this example config into .github/workflows/deploy-theme.yml. Then commit and push your changes:

name: Deploy Theme
on:
  push:
    branches:
      - master
      - main
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - 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 }}

This will trigger a deployment for every commit to master. If you'd like to change the "on" event, see the GitHub action documentation, which shows how to build on Pull Requests, Releases, Tags and more.

Configuration

The with portion of the workflow must be configured before the action will work. Any secrets must be referenced using the bracket syntax and stored in the GitHub repositories Settings/Secrets menu. You can learn more about setting environment variables with GitHub actions here.

Key Value Information Type Required
api-url The base URL of your Ghost Admin API, found by configuring a new Custom Integration in Ghost Admin β†’ Integrations secrets Yes
api-key The authentication key for your Ghost Admin API, found by configuring a new Custom Integration in Ghost Admin β†’ Integrations secrets Yes
exclude A list of files & folders to exclude from the generated zip file in addition to the defaults, e.g. "gulpfile.js *dist/*" string No
theme-name A custom theme name that overrides the default name in package.json. Useful if you use a fork of Casper, e.g. "my-theme" string No
file Path to a built zip file. If this is included, the exclude and theme-name options are ignored string No
working-directory A custom directory to zip when a theme is in a subdirectory, e.g. packages/my-theme string No

Β 

πŸ’‘ Use exclude to reduce the size of the zip file & keep deployment times minimal.

Β 


Don't forget to 🌟 Star 🌟 the repo if you like this GitHub Action!

Copyright & License

Copyright (c) 2013-2023 Ghost Foundation - Released under the MIT license.

action-deploy-theme's People

Contributors

ajaykarpur avatar daniellockyer avatar erisds avatar gep13 avatar joeegrigg avatar johnonolan avatar jschnurr avatar kevinansfield avatar minimaluminium avatar mrkwse avatar renovate-bot avatar renovate[bot] avatar royalfig avatar techbitsio avatar vikaspotluri123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

action-deploy-theme's Issues

Error while deploying

I'm trying this tool to deploy my theme on a self-hosted (docker) ghost 3 installation.

First question: I'm pushing code (files!) of my theme. Is it right?

This is my yaml:

name: Deploy Theme
on:
  push:
    branches:
      - master
jobs:
  deploy:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@master
      - name: Deploy Ghost Theme
        uses: TryGhost/[email protected]
        with:
          api-url: ${{ secrets.GHOST_ADMIN_API_URL }}
          api-key: ${{ secrets.GHOST_ADMIN_API_KEY }}
          theme-name: cosmonauta

If I try a simple blank commit I've a failure on "Deploy theme" action, these are error logs:

2020-03-17T18:38:35.2938186Z Error: Request failed with status code 413
2020-03-17T18:38:35.2963057Z     at createError (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.2.0/dist/index.js:646:15)
2020-03-17T18:38:35.2971497Z     at settle (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.2.0/dist/index.js:8063:12)
2020-03-17T18:38:35.2972347Z     at IncomingMessage.handleStreamEnd (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.2.0/dist/index.js:9093:11)
2020-03-17T18:38:35.2972950Z     at IncomingMessage.emit (events.js:215:7)
2020-03-17T18:38:35.2977539Z     at endReadableNT (_stream_readable.js:1184:12)
2020-03-17T18:38:35.2978939Z     at processTicksAndRejections (internal/process/task_queues.js:80:21) {
2020-03-17T18:38:35.2979881Z   isAxiosError: true,
2020-03-17T18:38:35.2980807Z   toJSON: [Function]
2020-03-17T18:38:35.2981672Z }
2020-03-17T18:38:35.3235437Z Post job cleanup.

Thanks!

Canary version deprecated in admin api

Hello πŸ‘‹

I've been trying to use this action to deploy a theme to my blog.

This is what my action yaml looks like:

name: Deploy Theme
on:
  push:
    branches:
      - prod
jobs:
  deploy:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/[email protected]
      - name: Deploy Ghost Theme
        uses: TryGhost/[email protected]
        with:
          theme-name: mnml
          api-url: ${{ secrets.GHOST_ADMIN_API_URL }}
          api-key: ${{ secrets.GHOST_ADMIN_API_KEY }}

The github action fails raises a warning with the following error:

@tryghost/admin-api: The 'version' parameter has a deprecated format 'canary', please use 'v{major}.{minor}' format instead

I have traced this back to the admin api SDK dependency, which appears to have dropped support for 'canary' as a version.
However, this action always defaults it to canary.

Suggested solution

I believe that this can be resolved as follows:

  • Add an optional with param to specify version
  • When provided, pass it on to the admin api.
  • When not provided, omit it from the config.

Let me know what you think!

Deploy error

Trying version 1.4.1.

[...]

  adding: index.hbs (deflated 36%)
70
Error [NotFoundError]: Resource not found
71
    at /home/runner/work/_actions/TryGhost/action-deploy-theme/v1.4.1/dist/index.js:7300:33
72
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
73
    at async main (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.4.1/dist/index.js:1572:9) {
74
  name: 'NotFoundError',
75
  context: null,
76
  type: 'NotFoundError',
77
  details: null,
78
  property: null,
79
  help: null,
80
  code: null,
81
  id: '8a7a8940-acb0-11eb-a1f8-31e5b5a12110'
82
}

Github giving a deprecation warning when running this Action

Using this file:

jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Deploy Ghost Theme
uses: TryGhost/[email protected]
with:
api-url: ${{ secrets.GHOST_ADMIN_API_URL }}
api-key: ${{ secrets.GHOST_ADMIN_API_KEY }}

Github action appears to work, but get this message:

deployNode.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: TryGhost/[email protected]

dist directory being ignored

I store my built assets in assets/dist. When I have this action enabled, my theme is successfully deployed to my production server, but the dist directory never comes along for the ride, which means none of my CSS, JS, or fonts are available.

I searched the documentation and the source code and I see no evidence that directories called dist are ignored by default. What am I missing?

API Client does not support Ghost v5.54.x

Github action to deploy the our theme is throwing the following error after we updated our Ghost instance:

{
  "name": "RequestNotAcceptableError",
  "context": "Provided client accept-version v5.0 is behind current Ghost version v5.54.",
  "type": "RequestNotAcceptableError",
  "details": null,
  "property": null,
  "help": "Try upgrading your Ghost API client.",
  "code": "UPDATE_CLIENT",
  "id": "3a52a090-274e-11ee-ba14-2ba7a50ffcef",
  "ghostErrorCode": null
}

Build fails, only gives `{}`

My API URL and key secretes are set, although whenever the deployment runs I get the following:

Run TryGhost/action-deploy-theme@v1
  with:
    api-url: ***
    api-key: ***
{}

Here's my workflow:

name: Deploy Theme
on:
  push:
    branches:
      - dev
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 }}

Any way to increase the upload timeout?

The workflow upload step fails with:

{
"message": "Request failed with status code 504",
"name": "AxiosError",
"code": "ERR_BAD_RESPONSE",
"status": null
}

But ghost log prints:

POST /ghost/api/admin/themes/upload/" 200 62205ms

Is there a way to increase the request timeout?

Side question, is this action supposed to switch to the new theme after upload or does the new theme have to be switched to manually from the admin panel?

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

The "master" branch is no longer the default branch name for actions/checkout

Issue Summary

When using this action, a warning is shown:

image

The "master" branch is no longer the default branch name for actions/checkout
Please pin to a specific version or use "main".

Reproduction

  • Create an event that triggers a theme deploy, e.g. push to your default branch
  • View the annotations on the deploy action

This issue is caused because we documented calling

- uses: actions/checkout@master

As one of the steps in our deploy workflow file deploy-theme.yml

This line (roughly line 10) needs changing from - uses: actions/checkout@master to - uses: actions/checkout@v2

503 error on deploying theme

Description

I am using github action to deploy my ghost theme into Ghost Pro.

I have 502 error when uploading the theme.

Error: Request failed with status code 503
    at createError (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.2.1/dist/index.js:956:15)
    at settle (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.2.1/dist/index.js:8437:12)
    at IncomingMessage.handleStreamEnd (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.2.1/dist/index.js:9466:11)
    at IncomingMessage.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1184:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  isAxiosError: true,
  toJSON: [Function]

But the theme is present in the UI

image

Errors when API URL is wrong is hard to understand

When API URL is wrong, the following error is returned.

Run TryGhost/[email protected]
Error [InternalServerError]: Invalid Version: null
    at /home/runner/work/_actions/TryGhost/action-deploy-theme/v1.5.0/dist/index.js:8160:33
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async main (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.5.0/dist/index.js:2009:9) {
  context: null,
  type: 'InternalServerError',
  details: null,
  property: null,
  help: null,
  code: null,
   ...
  ghostErrorCode: null
}

It should be something more indicative of the error.

Github certification

Any plan about the Github certification ? "Verified creator".
Sadly I can't use without :/

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Lock file maintenance

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/major.yml
  • nowactions/update-majorver 350dbed53ee9d6cd1f75ab4a3f9b9eba7e32bb64
.github/workflows/test.yml
  • actions/checkout v4
  • actions/setup-node v4
npm
package.json
  • @actions/core 1.10.1
  • @actions/exec 1.1.1
  • @tryghost/admin-api 1.13.12
  • @vercel/ncc ^0.38.0
  • eslint 8.57.0
  • eslint-plugin-ghost 3.4.0

  • Check this box to trigger a request for Renovate to run again on this repository

action.yml missing `theme-name` config var

theme-name does not appear in action.yml and so causes a warning when run as follows:

Unexpected input 'theme-name', valid inputs are ['api-url', 'api-key', 'exclude', 'file']

Deploy error - Cannot destructure property 'theme' of 'undefined'

Hi,

I'm not able to deploy my theme anymore, as I used to do. I don't think I changed anything here.
I'm using the online version of Ghost.

This is the error I face:

Error [InternalServerError]: Cannot destructure property 'theme' of 'undefined' as it is undefined.
    at /home/runner/work/_actions/TryGhost/action-deploy-theme/v1.4.0/dist/index.js:7300:33
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async main (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.4.0/dist/index.js:1572:9) {
  name: 'InternalServerError',
  context: null,
  type: 'InternalServerError',
  details: null,
  property: null,
  help: null,
  code: null,
  id: '2b380560-e096-11eb-97cd-e1a27588ea00'
}

This is my config:

name: Deploy Theme
on:
  push:
    branches:
      - master
      - main
jobs:
  deploy:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - name: Deploy Ghost Theme
        uses: TryGhost/[email protected]
        with:
          api-url: ${{ secrets.GHOST_ADMIN_API_URL }}
          api-key: ${{ secrets.GHOST_ADMIN_API_KEY }}

Error deploying to Ghost blog

I've used action-deploy-theme for multiple blogs but with my most recent one it's failing. I tried pretty much everything but can't figure it out.

Running Ghost 4.40.0 on Yunohost.

Tried both with a Casper theme and Edition theme.

Error: Resource not found
at /home/runner/work/_actions/TryGhost/action-deploy-theme/v1.5.0/dist/index.js:8160:33
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async main (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.5.0/dist/index.js:2009:9) {
name: undefined,
errorType: 'NotFoundError'
}

Any ideas?

Errors show as `[ [Object] ]` in the log

When an error is thrown by the action, the errors object does not show the actual error in the log. Instead, [ [Object] ] is presented in it's place.

  name: 'ThemeValidationError',
  context: null,
  type: 'ThemeValidationError',
  details: {
    checkedVersion: '4.x',
    name: 'my-theme',
    path: '/tmp/4a087165-c677-412d-8fe3-47b685ede062',
    version: '4.2.0',
    errors: [ [Object] ]
  },
  property: null,
  help: null,
  code: null,
  id: '77720cb0-3fe0-11ec-823b-2356111094be'
}

Custom path to actual template?

Many template packages have documentation, developer editions, etc. and are not simply a folder with package.json in the root of it. Is it possible to support these kinds of templates, possibly by specifying a path to the actual template relative to the root of the repo? This would have the benefit of supporting dev & prod templates within one repo, as I could point "development" to my stage server and " at my production. Plus it would have the benefit that I could merge updates from the original provider without having to alter the folder structure.

Node.js 12 actions stopping deployment

Hi,

I try deploying my ghost theme and keep getting the message as shown on the screenshot:

image

Although it show as a warning, it stops the deployment.

deploy-theme.yml is as follows:

name: Krabi Theme Deploy
on:
push:
branches:
- master
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: TryGhost/[email protected]
with:
api-url: ${{ secrets.GHOST_ADMIN_API_URL }}
api-key: ${{ secrets.GHOST_ADMIN_API_KEY }}

Please advise what to do?

Node.js 16 deprecated

I was receiving 2 errors about Node.js 16 deprecation. I changed actions/checkout@v3 to v4 and that eliminated one of them. Unsure of how to fix the last one as it looks like the script here still explicitly uses Node 16 in action.yaml

Error: Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: TryGhost/action-deploy-theme@v1.

After fixing this, the example script in the description should be updated as well.

Error: Request body larger than maxBodyLength limit

Hello!

I'm seeing this issue when uploading a ~150MB theme file. I've confirmed that I'm running @tryghost/[email protected], which has the patch to increase the axios maxBodyLength config option to Infinity (patch here). My Nginx server is configured for a max length of 500MB.

Any ideas?

Run TryGhost/[email protected]
  with:
    api-url: ***
    api-key: ***
    theme-name: ***
    file: ./theme.zip
Error [ERR_FR_MAX_BODY_LENGTH_EXCEEDED]: Request body larger than maxBodyLength limit
    at RedirectableRequest.module.exports.549.RedirectableRequest.write (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.5.0/dist/index.js:10098:24)
    at FormData.ondata (internal/streams/legacy.js:19:31)
    at FormData.emit (events.js:314:20)
    at FormData.module.exports.547.CombinedStream.write (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.5.0/dist/index.js:9919:8)
    at DelayedStream.ondata (internal/streams/legacy.js:19:31)
    at DelayedStream.emit (events.js:314:20)
    at DelayedStream.module.exports.152.DelayedStream._handleEmit (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.5.0/dist/index.js:3315:15)
    at ReadStream.source.emit (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.5.0/dist/index.js:3262:19)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9) {
  isAxiosError: true,
  toJSON: [Function: toJSON]
}

yarn zip is not being used by the github action

When I look at the source theme repo, it has yarn zip to generate the theme zip which uses gulp internally.

Considering that github actions does direct zipping, things seem to be not working as expected.

I have added a custom js file which is part of the zip prepared by the github actions, but it actually doesn't get used after getting uploaded to ghost. Ghost seems to generate a source.js file at some point which doesn't contain the custom js file that I added.

Is there a reason why yarn zip is not used to package the theme?

Error on theme deploy

Hi,
I'm getting this error when my workflow attempts to deploy my custom theme using this action:

Error [InternalServerError]: Cannot destructure property theme of 'undefined' or 'null'.
at /home/runner/work/_actions/TryGhost/action-deploy-theme/v1.4.1/dist/index.js:7300:33
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async main (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.4.1/dist/index.js:1572:9) {

Action Deploy Error

I faced the issue with deploy as below

Run TryGhost/[email protected]
Error: Request failed with status code 503
/usr/bin/zip -r ubud.zip . -x *.git* *.zip yarn* npm* node_modules* *routes.yaml *redirects.yaml *redirects.json
    at createError (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.4.1/dist/index.js:975:15)
  adding: home-image-circle.hbs (deflated 58%)
    at settle (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.4.1/dist/index.js:8530:12)
  adding: partials/ (stored 0%)
    at IncomingMessage.handleStreamEnd (/home/runner/work/_actions/TryGhost/action-deploy-theme/v1.4.1/dist/index.js:9559:11)
    at IncomingMessage.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1184:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  isAxiosError: true,
  toJSON: [Function]
}

disable certificate verification

Hi, there!
I am trying to deploy a theme to my staging server with UNABLE_TO_GET_ISSUER_CERT_LOCALLY
Is there a way to disable verification?

Compile assets before uploading

My theme needs to build assets before uploading. It would be nice to add an option to run gulp/webpack whatever or, as an alternative, accept an existing zip file instead of creating one.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.