Skip to content

Commit 4638f23

Browse files
committed
migrate gitlab-ci to github workflows and gitlab package registry to sonatype central
1 parent 5826bfb commit 4638f23

File tree

6 files changed

+122
-236
lines changed

6 files changed

+122
-236
lines changed

.github/workflows/publish.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish
2+
on:
3+
push:
4+
tags:
5+
- "*"
6+
7+
jobs:
8+
verify:
9+
uses: ./.github/workflows/verify.yaml
10+
publish:
11+
runs-on: ubuntu-latest
12+
needs: [verify]
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: setup java
16+
uses: graalvm/setup-graalvm@v1
17+
with:
18+
java-version: "21"
19+
distribution: graalvm
20+
cache: "gradle"
21+
- name: Publish
22+
run: |
23+
VERSION=${GITHUB_REF#refs/tags/}
24+
echo "Publishing version '${VERSION}'"
25+
./gradlew "-Pversion=$VERSION" publishToCentralPortal
26+
env:
27+
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
28+
SIGNING_SECRETKEY: ${{ secrets.SIGNING_SECRETKEY }}
29+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
30+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
31+
LIBRARY_GROUP: ${{ vars.LIBRARY_GROUP }}
32+
SIGNING_KEYID: ${{ vars.SIGNING_KEYID }}

.github/workflows/verify.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Verify
2+
on:
3+
pull_request:
4+
workflow_call:
5+
push:
6+
branches: ["**"]
7+
# Don't run on tags, publish will call this workflow
8+
tags-ignore: ["**"]
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: setup java
16+
uses: graalvm/setup-graalvm@v1
17+
with:
18+
java-version: "21"
19+
distribution: graalvm
20+
cache: "gradle"
21+
- name: Lint
22+
run: ./gradlew lintKotlin
23+
test:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
- name: setup java
28+
uses: graalvm/setup-graalvm@v1
29+
with:
30+
java-version: "21"
31+
distribution: graalvm
32+
cache: "gradle"
33+
- name: Test
34+
run: ./gradlew test
35+
- name: Check version not present
36+
run: |
37+
GRADLE_VERSION=$(./gradlew properties | grep '^version:' | awk '{print $2}')
38+
if [ "$GRADLE_VERSION" != "unspecified" ]; then
39+
echo "ERROR - build.gradle(.kts) has a hardcoded version ($GRADLE_VERSION). No version is allowed in build.gradle(.kts)"
40+
exit 1
41+
fi

.gitlab-ci.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
[![N|Solid](https://valensas.com/img/logo.png)](https://nodesource.com/products/nsolid)
2-
# Valensas Util Library
1+
# Util Library
32
It is the library that contains common object mapper configurations and extensions.
43

54
### Change log

build.gradle.kts

Lines changed: 48 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,20 @@
11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
22

33
plugins {
4-
id("org.springframework.boot") version "3.2.0"
54
id("io.spring.dependency-management") version "1.1.4"
65
id("org.jmailen.kotlinter") version "4.1.0"
76
id("maven-publish")
87
id("java-library")
98
kotlin("jvm") version "1.9.21"
109
kotlin("plugin.spring") version "1.9.21"
10+
id("net.thebugmc.gradle.sonatype-central-portal-publisher") version "1.2.4"
1111
}
1212

1313
group = "com.valensas"
14-
version = "3.2.0"
1514
java.sourceCompatibility = JavaVersion.VERSION_17
1615

1716
repositories {
1817
mavenCentral()
19-
if (project.hasProperty("GITLAB_REPO_URL")) {
20-
maven {
21-
name = "Gitlab"
22-
url = uri(project.property("GITLAB_REPO_URL").toString())
23-
credentials(HttpHeaderCredentials::class.java) {
24-
name = project.findProperty("GITLAB_TOKEN_NAME")?.toString()
25-
value = project.findProperty("GITLAB_TOKEN")?.toString()
26-
}
27-
authentication {
28-
create("header", HttpHeaderAuthentication::class)
29-
}
30-
}
31-
}
3218
}
3319

3420

@@ -37,7 +23,7 @@ dependencies {
3723
compileOnly("org.springframework.boot:spring-boot-starter-webflux")
3824
implementation("org.springframework.data:spring-data-commons")
3925
implementation("org.jetbrains.kotlin:kotlin-reflect")
40-
implementation("com.valensas:exception:2.1.0")
26+
implementation("com.valensas:exception:2.4.2")
4127
compileOnly("io.micrometer:micrometer-core")
4228
api("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:1.7.3")
4329
testImplementation("org.springframework.boot:spring-boot-starter-webflux")
@@ -51,30 +37,61 @@ tasks.withType<KotlinCompile> {
5137
}
5238
}
5339

40+
dependencyManagement {
41+
imports {
42+
mavenBom("org.springframework.boot:spring-boot-dependencies:3.2.0")
43+
}
44+
}
45+
5446
tasks.withType<Test> {
5547
useJUnitPlatform()
5648
}
5749

5850
publishing {
51+
publications {
52+
create("library", MavenPublication::class.java) {
53+
artifactId = "util"
54+
from(components["java"])
55+
}
56+
}
5957
repositories {
60-
if (System.getenv("CI_API_V4_URL") != null) {
61-
maven {
62-
name = "Gitlab"
63-
url = uri("${System.getenv("CI_API_V4_URL")}/projects/${System.getenv("CI_PROJECT_ID")}/packages/maven")
64-
credentials(HttpHeaderCredentials::class.java) {
65-
name = "Job-Token"
66-
value = System.getenv("CI_JOB_TOKEN")
67-
}
68-
authentication {
69-
create("header", HttpHeaderAuthentication::class)
70-
}
58+
mavenLocal()
59+
}
60+
}
61+
62+
signing {
63+
val keyId = System.getenv("SIGNING_KEYID")
64+
val secretKey = System.getenv("SIGNING_SECRETKEY")
65+
val passphrase = System.getenv("SIGNING_PASSPHRASE")
66+
67+
useInMemoryPgpKeys(keyId, secretKey, passphrase)
68+
}
69+
70+
centralPortal {
71+
name = "util"
72+
username = System.getenv("SONATYPE_USERNAME")
73+
password = System.getenv("SONATYPE_PASSWORD")
74+
pom {
75+
name = "Util"
76+
description = "A simple library that contains common object mapper configurations and extensions for Spring Boot."
77+
url = "https://valensas.com/"
78+
scm {
79+
url = "https://github.com/Valensas/util"
80+
}
81+
82+
licenses {
83+
license {
84+
name.set("MIT License")
85+
url.set("https://mit-license.org")
7186
}
7287
}
73-
}
7488

75-
publications {
76-
create<MavenPublication>("artifact") {
77-
from(components["java"])
89+
developers {
90+
developer {
91+
id.set("0")
92+
name.set("Valensas")
93+
email.set("info@valensas.com")
94+
}
7895
}
7996
}
8097
}

0 commit comments

Comments
 (0)