Add CI/CD
This commit is contained in:
parent
5f56af3cd0
commit
8b8dcb7ebe
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
global-variables:
|
||||
gradle-image: &gradle-image gradle:7.1-jdk11
|
||||
|
||||
kind: pipeline
|
||||
name: default
|
||||
type: docker
|
||||
|
||||
steps:
|
||||
- name: gradle-test
|
||||
image: *gradle-image
|
||||
commands:
|
||||
- gradle test
|
||||
when:
|
||||
branch: develop
|
||||
|
||||
- name: publish
|
||||
image: *gradle-image
|
||||
environment:
|
||||
MAVEN_REPOSITORY_URL: https://archiva.fyloz.dev/repository/internal/
|
||||
MAVEN_REPOSITORY_USERNAME:
|
||||
from_secret: maven_repository_username
|
||||
MAVEN_REPOSITORY_PASSWORD:
|
||||
from_secret: maven_repository_password
|
||||
commands:
|
||||
- gradle publish -Pversion=${DRONE_TAG}
|
||||
when:
|
||||
event:
|
||||
- tag
|
|
@ -1,8 +1,8 @@
|
|||
group = "dev.fyloz"
|
||||
version = "1.0"
|
||||
|
||||
plugins {
|
||||
id("org.jetbrains.kotlin.jvm") version "1.6.10"
|
||||
id("maven-publish")
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
@ -21,6 +21,39 @@ dependencies {
|
|||
testImplementation("io.mockk:mockk:1.12.2")
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("memory-cache") {
|
||||
from(components["kotlin"])
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
val repoUrl = System.getenv("MAVEN_REPOSITORY_URL")
|
||||
val repoUsername = System.getenv("MAVEN_REPOSITORY_USERNAME")
|
||||
val repoPassword = System.getenv("MAVEN_REPOSITORY_PASSWORD")
|
||||
val repoName = System.getenv("MAVEN_REPOSITORY_NAME") ?: "Archiva"
|
||||
|
||||
if (repoUrl != null && repoUsername != null && repoPassword != null) {
|
||||
url = uri(repoUrl)
|
||||
name = repoName
|
||||
|
||||
credentials {
|
||||
username = repoUsername
|
||||
password = repoPassword
|
||||
}
|
||||
} else {
|
||||
print("Some maven repository credentials were not configured, publishing is not configured")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
|
||||
testLogging {
|
||||
events("failed")
|
||||
}
|
||||
}
|
|
@ -1 +1,2 @@
|
|||
kotlin.code.style=official
|
||||
kotlin.code.style=official
|
||||
version=dev
|
Loading…
Reference in New Issue