Skip to content

Commit 3e5df8f

Browse files
committed
chore: 优化构建,使用devops publish 插件 #230
1 parent cbff03a commit 3e5df8f

14 files changed

Lines changed: 56 additions & 126 deletions

File tree

.github/scripts/create_pr_body.sh

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

.github/workflows/publish-snapshot-jdk17.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ jobs:
2727
- name: Publish snapshot package
2828
if: github.repository == 'bkdevops-projects/devops-framework'
2929
env:
30-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
31-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
30+
ORG_GRADLE_PROJECT_repoUsername: ${{ secrets.SONATYPE_USERNAME }}
31+
ORG_GRADLE_PROJECT_repoPassword: ${{ secrets.SONATYPE_PASSWORD }}
3232
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
3333
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
3434
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}

.github/workflows/publish-snapshot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ jobs:
2626
- name: Publish snapshot package
2727
if: github.repository == 'bkdevops-projects/devops-framework'
2828
env:
29-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
30-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
29+
ORG_GRADLE_PROJECT_repoUsername: ${{ secrets.SONATYPE_USERNAME }}
30+
ORG_GRADLE_PROJECT_repoPassword: ${{ secrets.SONATYPE_PASSWORD }}
3131
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
3232
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
3333
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ jobs:
6363
run: ./gradlew build
6464
- name: Publish release package
6565
env:
66-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
67-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
66+
ORG_GRADLE_PROJECT_repoUsername: ${{ secrets.SONATYPE_USERNAME }}
67+
ORG_GRADLE_PROJECT_repoPassword: ${{ secrets.SONATYPE_PASSWORD }}
6868
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
6969
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
7070
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}

build.gradle.kts

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,57 @@ plugins {
77
kotlin("kapt") version Versions.Kotlin apply false
88
kotlin("plugin.spring") version Versions.Kotlin apply false
99
id("io.spring.dependency-management") version Versions.DependencyManagement apply false
10-
id("io.github.gradle-nexus.publish-plugin") version Versions.GradleNexusPublish
1110
id("com.tencent.devops.release") version Versions.DevopsReleasePlugin
11+
id("com.tencent.devops.publish") version Versions.DevopsReleasePlugin
1212
}
1313

14+
val projectVersion = rootProject.file("version.txt").readText()
15+
1416
allprojects {
15-
group = Release.Group
16-
version = Release.Version
17+
group = "com.tencent.devops"
18+
version = projectVersion
19+
20+
apply(plugin = "com.tencent.devops.publish")
1721

1822
repositories {
1923
mavenCentral()
2024
jcenter()
2125
gradlePluginPortal()
2226
}
23-
}
2427

25-
nexusPublishing {
26-
repositories {
27-
sonatype {
28-
username.set(System.getenv("SONATYPE_USERNAME"))
29-
password.set(System.getenv("SONATYPE_PASSWORD"))
28+
publishing {
29+
publications {
30+
withType<MavenPublication> {
31+
pom {
32+
name.set(project.name)
33+
description.set(project.description ?: project.name)
34+
url.set("https://github.com/bkdevops-projects/devops-framework")
35+
licenses {
36+
license {
37+
name.set("The MIT License (MIT)")
38+
url.set("https://opensource.org/licenses/MIT")
39+
}
40+
}
41+
organization {
42+
name.set("Tencent BK-CI")
43+
url.set("https://github.com/Tencent/bk-ci")
44+
}
45+
developers {
46+
developer {
47+
name.set("blueking")
48+
email.set("contactus_bk@tencent.com")
49+
url.set("https://github.com/TencentBlueKing")
50+
roles.set(listOf("Java Developer"))
51+
}
52+
}
53+
scm {
54+
connection.set("scm:git:git://github.com/bkdevops-projects/devops-framework.git")
55+
developerConnection.set("scm:git:ssh://github.com/bkdevops-projects/devops-framework.git")
56+
url.set("https://github.com/bkdevops-projects/devops-framework")
57+
}
58+
}
59+
60+
}
3061
}
3162
}
3263
}

buildSrc/src/main/kotlin/Versions.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
import java.io.File
2-
3-
object Release {
4-
const val Group = "com.tencent.devops"
5-
val Version = File("version.txt").readText().trim()
6-
}
7-
81
object Versions {
92
const val Jib: String = "3.2.0"
103
const val Java = "1.8"

buildSrc/src/main/kotlin/publish.gradle.kts

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

devops-boot-project/devops-boot-core/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ subprojects {
1313
apply(plugin = "org.jetbrains.kotlin.kapt")
1414
apply(plugin = "org.jetbrains.kotlin.plugin.spring")
1515
apply(plugin = "io.spring.dependency-management")
16-
apply(plugin = "publish")
1716

1817
dependencyManagement {
1918
imports {

devops-boot-project/devops-boot-dependencies/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
plugins {
22
`java-platform`
3-
id("publish")
43
}
54

65
description = "DevOps Boot Dependencies"

devops-boot-project/devops-boot-starters/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ description = "Starter for DevOps Boot"
88
subprojects {
99
apply(plugin = "java-library")
1010
apply(plugin = "io.spring.dependency-management")
11-
apply(plugin = "publish")
1211

1312
dependencyManagement {
1413
imports {

0 commit comments

Comments
 (0)