
task xbibUpload(type: Upload) {
    configuration = configurations.archives
    uploadDescriptor = true
    repositories {
        if (project.hasProperty('xbibUsername')) {
            mavenDeployer {
                configuration = configurations.wagon
                repository(url: uri('scpexe://xbib.org/repository')) {
                        authentication(userName: xbibUsername, privateKey: xbibPrivateKey)
                }
            }
        }
    }
}

task sonatypeUpload(type: Upload) {
    configuration = configurations.archives
    uploadDescriptor = true
    repositories {
        if (project.hasProperty('ossrhUsername')) {
            mavenDeployer {
                beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
                repository(url: uri(ossrhReleaseUrl)) {
                        authentication(userName: ossrhUsername, password: ossrhPassword)
                }
                snapshotRepository(url: uri(ossrhSnapshotUrl)) {
                        authentication(userName: ossrhUsername, password: ossrhPassword)
                }
                pom.project {
                    name projectName
                    description projectDescription
                    packaging 'jar'
                    inceptionYear '2016'
                    url scmUrl
                    organization {
                        name 'xbib'
                        url 'http://xbib.org'
                    }
                    developers {
                        developer {
                            id user
                            name 'Jörg Prante'
                            email 'joergprante@gmail.com'
                            url 'https://github.com/jprante'
                        }
                    }
                    scm {
                        url scmUrl
                        connection scmConnection
                        developerConnection scmDeveloperConnection
                    }
                    licenses {
                        license {
                            name 'The Apache License, Version 2.0'
                            url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                        }
                    }
                }
            }
        }
    }
}

githubPages {
    repoUri = 'git@github.com:xbib/marc.git'
    targetBranch = "gh-pages"
    pages {
        from(file('build/jbake')) {
            into '.'
        }
    }
}
