apply plugin: 'maven-publish'

task javadocsJar(type: Jar) {
    classifier = 'javadoc'
}

publishing {
    publications.all {
        artifact javadocsJar

        pom {
            description = "${project.name}"
            name = "${project.name}"
            url = "https://github.com/PostsSystem/core.git"

            scm {
                developerConnection = "scm:git:[fetch=]git@github.com:PostsSystem/core.git[push=]git@github.com:PostsSystem/core.git"
                url = "git@github.com:PostsSystem/core.git"
            }

            developers {
                
                    developer {
                        id = "InsanusMokrassar"
                        name = "Aleksei Ovsiannikov"
                        email = "ovsyannikov.alexey95@gmail.com"
                    }
                

                    developer {
                        id = "000Sanya"
                        name = "Syrov Aleksandr"
                        email = "000sanya.000sanya@gmail.com"
                    }
                
            }

            licenses {
                
                    license {
                        name = "Apache Software License 2.0"
                        url = "https://opensource.org/licenses/Apache-2.0"
                    }
                
            }
        }
        repositories {
            if ((project.hasProperty('GITHUBPACKAGES_USER') || System.getenv('GITHUBPACKAGES_USER') != null) && (project.hasProperty('GITHUBPACKAGES_PASSWORD') || System.getenv('GITHUBPACKAGES_PASSWORD') != null)) {
                maven {
                    name = "GitHubPackages"
                    url = uri("https://maven.pkg.github.com/PostsSystem/core")
                    credentials {
                        username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER')
                        password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD')
                    }
                }
            }
        }
    }
}
