TryGhost / action-deploy-theme

:octocat: Deploy your Ghost theme with Github Actions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom path to actual template?

matellis opened this issue · comments

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.

Example: Advant theme has the following in the root folder:

advant
demo data
development
documentation
advant.zip
routes.yaml

The advant folder is simply the compressed production version of development and advant.zip is a compressed and deployable version of advent. I'm unable to even use that as when I set the file property it won't find the file (or I can't figure out the right path for it).

If I understand the OP correctly, I have a similar setup, where my repo root has multiple themes:

# pwd
/var/www/[website]/content/themes

# ls
casper
casper-mod

The action is looking inside /var/www/[website]/content/themes (or more specifically ${{ github.workspace }} )for package.json, where is doesn't exist.

In the workspace yaml, we can use:

defaults:
  run:
    working-directory: './casper-mod'

Which sets the working directory to ${{ github.workspace }}/casper-mod. Howerver, the action is overriding this in index.js:

const basePath = process.env.GITHUB_WORKSPACE;
const pkgPath = path.join(process.env.GITHUB_WORKSPACE, 'package.json');

IMHO, this shouldn't be hard coded. Most actions support working-directory.

If I am not mistaken, this is what this PR will do: #39.

My workaround is to create a task before the TryGhost/action-deploytheme@v1.4.0 that copies the files from the child directory to the root (${{ github.workspace }}):

- name: 1.4 - Move files to root ${{ github.workspace }}
  run: |
    echo Move files so Ghost deploy action can see them...
    cp -R --verbose ./${{ env.themeName }}/* . 

where env.themeName = casper-mod.

This was closed by #39