jimporter / mike

Manage multiple versions of your MkDocs-powered documentation via Git
BSD 3-Clause "New" or "Revised" License
528 stars 47 forks source link

Using without github ? #102

Closed VladoPortos closed 2 years ago

VladoPortos commented 2 years ago

Is there a way to use this without gitlhub ? I'm doing my own hosting and building of the documentation. I would like to have ability to switch between versions, but I do not use github.

The mike deploy fails with: error: error getting config 'user.name'

Not sure what to do about it.

jimporter commented 2 years ago

Make sure you set a Git user/email via git config user.name (and user.email) wherever mike is running so it knows what to use when generating the commit with your docs. (Or upgrade to the latest dev version, which relaxes this restriction and should allow empty users/emails.)

VladoPortos commented 2 years ago

Thanks @jimporter, it worked after adding this values. But I'm still not sure about one thing. I need to copy the generated files into my hosting. But I noticed it does build the "site" in master branch and in the separate branch it does 1.0, 1.1 etc... what do I need to upload to my web hosting ? Before I just copied all from "site" folder...

jimporter commented 2 years ago

You'll need to upload everything in the latest revision of your gh-pages branch (or at least, everything that changed since the last time you did this). You could check that branch out and then upload the files or run something like git archive -o site.tar gh-pages to generate a tarball of everything to upload.

VladoPortos commented 2 years ago

Maybe I'm too tired, but I don't get it. What should be the structure of the final page ?

Like now its:

site\
    index.html
    search/
    aws/
    docker/
    scripts/
    etc...
    .
    .
    .

Thats in the main branch of the project. and that was the only folder content I needet do copy to my hosting to show the page. Now I have the same + additional branch gh-pages where is something like

1.0/
2.0/
versions.json
 .nojekyll

Should I merge the content of gh-pages into the master branch inside the site/ directory ? ( is there some kind of sitch to do that automatically ?)

jimporter commented 2 years ago

Here's the process:

  1. Get all the files in the current revision of your gh-pages branch (or whatever branch you told mike to write to). This could be by checking out the branch, or via git archive -o site.tar gh-pages if an archive file is more convenient. This should look like:
    path/to/repo/  -or-  site.tar
     1.0/
     2.0/
     index.html
     versions.json
     .nojekyll
  2. Delete the previous contents of the site so no stale files are hanging around.
  3. Upload everything from (1) into the right spot on your server. Users should be able to go to https://your-server.com/1.0/ to see the docs in the 1.0 directory above.
VladoPortos commented 2 years ago

Thanks @jimporter I think I get it. Very strange solution though :)

jimporter commented 2 years ago

Well, mike is primarily oriented around pushing to a remote Git branch and having a post-receive hook on the remote to deploy to a webserver (e.g. Github's automatic pages-build-deployment post-receive hook). Pulling the generated docs back out of that pipeline to upload manually is a bit trickier though, since that's not how mike is designed to work.

VladoPortos commented 2 years ago

@jimporter I know, I did decide not to use it in the end. It would complicate the build process and ci/cd I have set up already. So one version of document it is, for now :)

jgarte commented 1 year ago

@VladoPortos

Have you revisited the idea of deploying multiple versions of your documentation website?

I'm also facing this issue as I need to deploy an internal documentation website to a custom server that is not GitHub Pages.