## Introduction

In one of my open-source projects - ReactiveNetwork I have a documentation in README.md file and I have JavaDocs as well. This project is an Android library written in Java and built with Gradle. Moreover, I develop this project on two separate Git branches - one for RxJava1.x and another one for RxJava2.x. Similar convention is in the RxJava repository, so I followed it. After each release I publish documentation and JavaDocs on GitHub pages for both versions. It’s kind of boring and repeatable task, so I was wondering if there’s any way to automate it.

and generates JavaDocs in library/build/docs/javadoc/ directory. I keep generated JavaDocs on gh-pages branch in /javadoc/RxJava1.x/ and /javadoc/RxJava2.x/ directories. Now, I need to checkout to RxJava2.x branch generate JavaDocs, switch to gh-pages branch delete contents of javadoc/RxJava2.x/ directory, copy contents from library/build/docs/javadoc/ into javadoc/RxJava2.x/, commit changes, do the same for RxJava1.x branch and push changes. As you noticed, It’s a lot of manual work. I’ve scripted it as follows in my update_javadocs.sh file:

## Generating user-friendly documentation

I keep my whole documentation for the user in README.md file. In order to generate user-friendly website with documentation I used docsify. You can install it as follows via npm:

Next, on gh-pages branch I’ve created docs/RxJava1.x/ and docs/RxJava2.x/ directories and copied there appropriate README.md files from RxJava1.x and RxJava2.x branches. Next I could go inside each directory and type:

Docsify generated nice website with documentation gathered dynamically from README.md file. After that, I’ve done a few manual adjustments. Now, the only thing a need to do is to keep README.md files updated. That’s why I made a script for copying README.md files from RxJava1.x and RxJava2.x branch into appropriate directories on gh-pages branch and named it update_docs.sh:

## Summary

Now, I have boring process of generating Docs and JavaDocs for two separate Git branches automated and I can simply invoke my scripts:

and that’s it! You can see websites with documentation at: