buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'org.ajoberstar:gradle-git:1.4.2'
    }
}

apply plugin: org.ajoberstar.gradle.git.ghpages.GithubPagesPlugin

ext {
    repoPath = 'dingodb/dingo'
}

githubPages {
    if (ghToken) {
        repoUri = "https://github.com/${repoPath}.git"
        credentials {
            username = System.getenv("GITHUB_ACTOR")
            password = System.getenv("GITHUB_TOKEN")
        }
    } else {
        repoUri = "git@github.com/${repoPath}.git"
    }

    pages {
        from(javadoc.outputs.files) {
            into 'docs/javadoc'
        }
    }
}

publishGhPages.dependsOn javadoc
