Deploy path doesn't work for Git Deploy Method in middleman-deploy
Asked Answered
H

2

17

I am using middleman-blog and middleman-deploy.

What I would like to do, is within the branch I am deploying to, I want the static files to be deployed to a subfolder within the repo (i.e. not the root folder).

I tried doing this in my config.rb:

activate :deploy do |deploy|
  deploy.build_before = true
  deploy.deploy_method = :git
  deploy.branch = 'gh-pages-2'
  deploy.remote = 'github'
  deploy.path = 'blog'
end

But that doesn't work, it still deploys to the root directory. In fact, it doesn't even create the /blog folder I am looking for.

When I visit the config settings locally, these are the settings I see under :deploy:

:deploy
   :branch = "gh-pages"
   :build_before = true
   :clean = false
   :commit_message = nil
   :deploy_method = :git
   :flags = nil
   :host = nil
   :password = nil
   :path = "blog"
   :port = 22
   :remote = "github"
   :strategy = :force_push
   :user = nil

This indicates to me that the path attribute is being set correctly.

I also tried doing deploy.path = '/blog' and that still doesn't work.

So how can I get this to deploy to \blog\ subfolder within my repo rather than the root directory?

The versions of the different gems are as follows:

middleman (4.1.10)
middleman-blog (4.0.1)
middleman-cli (4.1.10)
middleman-deploy (2.0.0.pre.alpha)

Note: I am purposely using gh-pages-2 because I don't want to overwrite my current gh-pages without being certain that it will deploy to the correct subfolder.

Harelda answered 27/8, 2016 at 3:22 Comment(1)
github.com/middleman-contrib/middleman-deploy/issues/114 ould not help? (like github.com/middleman-contrib/middleman-deploy/issues/…). Plus, you also have now another approach of using only one branch: https://mcmap.net/q/747127/-why-github-pages-on-username-github-io-won-39-t-showFionafionna
P
0

I think the easiest thing you could do is write an extension with an after build step: https://middlemanapp.com/advanced/custom-extensions/#after_build. That way you move the files during your build process and middleman-deploy just can push the whole build folder.

Phlegmy answered 13/8, 2017 at 22:57 Comment(0)
H
0

If the root of your site is also deployed on Github Pages you can create another repo called blog and deploy your middleman site there. Then by enabling GitHub Pages for the blog repo, you will actually have it deployed on yoursite.com/blog.

It is not the techiest solution you 'd expect but it works well for me

Horsehide answered 17/1, 2018 at 6:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.