public static void deployMkdocsOnGitHubPages(String version, File baseDirectory, String url, String scmUsername,
                                                 String scmPassword, Log logger) {
        try {
            // Find initial branch name
            List<String> gitStatusOutput = getCommandOutput(new String[]{Constants.GIT_COMMAND,
                    Constants.GIT_BRANCH_COMMAND}, logger);
            String initialBranch = null;
            for (String gitStatusOutputLine : gitStatusOutput) {
                if (gitStatusOutputLine.startsWith(Constants.GIT_BRANCH_COMMAND_OUTPUT_CURRENT_BRANCH_PREFIX)) {
                    initialBranch = gitStatusOutputLine.substring(
                            Constants.GIT_BRANCH_COMMAND_OUTPUT_CURRENT_BRANCH_PREFIX.length());
                }
            }

            if (initialBranch != null) {
                // Stash changes
                executeCommand(new String[]{Constants.GIT_COMMAND,
                        Constants.GIT_STASH_COMMAND}, logger);

                // Change to gh-pages branch. This will not do anything if a new branch was created in the last command.
                executeCommand(new String[]{Constants.GIT_COMMAND,
                        Constants.GIT_CHECKOUT_COMMAND,
                        Constants.GIT_GH_PAGES_BRANCH}, logger);

                // Create branch if it does not exist. This will fail if the branch exists and will not do anything.
                executeCommand(new String[]{Constants.GIT_COMMAND,
                        Constants.GIT_CHECKOUT_COMMAND,
                        Constants.GIT_CHECKOUT_COMMAND_ORPHAN_ARGUMENT,
                        Constants.GIT_GH_PAGES_BRANCH}, logger);

                executeCommand(new String[]{Constants.GIT_COMMAND,
                        Constants.GIT_PULL_COMMAND,
                        Constants.GIT_REMOTE,
                        Constants.GIT_GH_PAGES_BRANCH}, logger);

                // Getting the site that was built by mkdocs
                File siteDirectory = new File(Constants.MKDOCS_SITE_DIRECTORY);
                FileUtils.copyDirectory(siteDirectory, baseDirectory);
                String[] siteDirectoryContent = siteDirectory.list();

                // Pushing the site to GitHub (Assumes that site/ directory is ignored by git)
                if (siteDirectoryContent != null && siteDirectoryContent.length > 0) {
                    List<String> gitAddCommand = new ArrayList<>();
                    Collections.addAll(gitAddCommand, Constants.GIT_COMMAND,
                            Constants.GIT_ADD_COMMAND);
                    Collections.addAll(gitAddCommand, siteDirectoryContent);
                    executeCommand(gitAddCommand.toArray(new String[gitAddCommand.size()]), logger);

                    List<String> gitCommitCommand = new ArrayList<>();
                    Collections.addAll(gitCommitCommand, Constants.GIT_COMMAND,
                            Constants.GIT_COMMIT_COMMAND,
                            Constants.GIT_COMMIT_COMMAND_MESSAGE_ARGUMENT,
                            String.format(Constants.GIT_COMMIT_COMMAND_MESSAGE_FORMAT, version, version),
                            Constants.GIT_COMMIT_COMMAND_FILES_ARGUMENT);
                    Collections.addAll(gitCommitCommand, siteDirectoryContent);
                    executeCommand(gitCommitCommand.toArray(new String[gitCommitCommand.size()]), logger);

                    if (scmUsername != null && scmPassword != null && url != null) {
                        // Using scm username and password env var values
                        String urlWithUsernameAndPassword = url.replaceFirst(Constants.GITHUB_URL,
                                Constants.GITHUB_URL_WITH_USERNAME_PASSWORD);
                        executeCommand(new String[]{Constants.GIT_COMMAND,
                                Constants.GIT_PUSH_COMMAND,
                                String.format(urlWithUsernameAndPassword, scmUsername, scmPassword),
                                Constants.GIT_GH_PAGES_BRANCH}, logger);

                    } else {
                        // Using git credential store
                        executeCommand(new String[]{Constants.GIT_COMMAND,
                                Constants.GIT_PUSH_COMMAND,
                                Constants.GIT_REMOTE,
                                Constants.GIT_GH_PAGES_BRANCH}, logger);
                    }
                }

                // Changing back to initial branch
                executeCommand(new String[]{Constants.GIT_COMMAND,
                        Constants.GIT_CHECKOUT_COMMAND,
                        initialBranch}, logger);
                executeCommand(new String[]{Constants.GIT_COMMAND,
                        Constants.GIT_STASH_COMMAND,
                        Constants.GIT_STASH_POP_COMMAND}, logger);
            } else {
                logger.warn("Unable to parse git-status command and retrieve current git branch. " +
                        "Skipping deployment.");
            }
        } catch (Throwable t) {
            logger.warn("Failed to deploy the documentation on github pages.", t);
        }
    }
Deploy the mkdocs website on GitHub pages

@param version       The version of the documentation
@param baseDirectory The base directory of the project
@param url           The SCM URL
@param scmUsername   The SCM username
@param scmPassword   The SCM password
@param logger        The maven logger
modules/siddhi-doc-gen/src/main/java/io/siddhi/doc/gen/core/utils/DocumentationUtils.java