Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extend_dirs cann't process relative path #78

Open
jpeterson opened this issue Aug 2, 2017 · 5 comments · May be fixed by #354
Open

extend_dirs cann't process relative path #78

jpeterson opened this issue Aug 2, 2017 · 5 comments · May be fixed by #354
Labels

Comments

@jpeterson
Copy link

jpeterson commented Aug 2, 2017

Hello,

I'm trying to use extend_dirs to publish a couple directories that live outside my hexo website (which is contained in a subdirectory of my main repo).

When I run hexo deploy, the directories I've identified are copied into the root of my website directory, but never get deployed. I think this is because only the public folder is being added to the .deploy_git directory. What is needed to actually deploy the contents of the extend_dirs?

I've included my file structure and deployment configuration below.

Thanks!

EDIT: I tested this by creating a directory inside my website folder and referenced that in extend_dirs, and it deploys as expected. It seems this issue only occurs when the directories exist outside the website folder.

File structure:

├─ repo
    ├─ docs
    ├─ src
    ├─ website
        ├─ public
        ├─ scaffolds
        ├─ source
        ├─ themes
        ├─ _config.yml

_config.yml:

deploy:
  type: git
  repo: <repository url>
  branch: gh-pages
  message:
  extend_dirs:
    - ../docs
    - ../src
@jpeterson
Copy link
Author

Taking a look at the source, I think this issue stems from the following line:

https://github.com/hexojs/hexo-deployer-git/blob/master/lib/deployer.js#L130

When pathFn.join encounters a ../ in dir, it outputs:

extendDist === website/src

instead of

extendDist === website/.deploy_git/src

@jpeterson
Copy link
Author

jpeterson commented Aug 2, 2017

Workaround:

Set up two deploy configurations, where the first one references the true location of your external directories, and the second refers to those directories within the hexo folder (since the first deploy will have copied them there for you).

Note: I point the first deploy to a dummy branch called temp, but I think this could just be the same as your real deployment branch since this deployment workflow will always execute the real one last.

deploy:
  - type: git
    repo: <repo>
    branch: temp
    extend_dirs:
      - ../src
      - ../docs
  - type: git
    repo: <repo>
    branch: gh-pages
    extend_dirs:
      - src
      - docs

@NoahDragon NoahDragon added the bug label Aug 2, 2017
@NoahDragon
Copy link
Member

Thanks for submitting the issue and its details. I think this may be a bug.

@stefanocudini
Copy link

I'have same problem, the bug it was fixed?

@uiolee
Copy link
Member

uiolee commented Apr 19, 2024

const extendDist = pathFn.join(deployDir, dir);

@uiolee uiolee changed the title extend_dirs not actually publishing anything extend_dirs cann't process relative path Apr 19, 2024
@uiolee uiolee linked a pull request Apr 19, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants