I basically used https://www.typora.io
, I really like it. But there are hundreds of other markdown editors out there. I like markdown because it's as simple as wiki syntax, but more portable and it also looks good simply viewed in a txt editor.
Then I just saved my files in a git repo, one file per chapter, and one directory for each "section" of the book. But there you are pretty free to organize like you want. Then, usually each publishing platform (gitbook, readthedocs, etc) asks for a config file to be placed in the repo, a bit like the CI sites do.