import org.apache.tools.ant.filters.ReplaceTokens

apply plugin: 'org.ajoberstar.git-publish'

if (project.hasProperty('githubToken')) {
  System.setProperty('org.ajoberstar.grgit.auth.username', project.githubToken)
}

gitPublish {
    repoUri = 'https://github.com/johnrengelman/shadow.git'

    branch = 'gh-pages'

    contents {
        from 'build/site'
        into('api') {
            from project.tasks.groovydoc
        }
        filter(ReplaceTokens, tokens: [version: project.version])
    }
}

tasks.gitPublishCopy.dependsOn yarn_build
tasks.gitPublishCopy.dependsOn groovydoc
