Skip to content

chore: 优化构建,使用devops publish 插件 #230 #231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .github/scripts/create_pr_body.sh

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/publish-snapshot-jdk17.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
- name: Publish snapshot package
if: github.repository == 'bkdevops-projects/devops-framework'
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_repoUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_repoPassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
- name: Publish snapshot package
if: github.repository == 'bkdevops-projects/devops-framework'
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_repoUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_repoPassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ jobs:
run: ./gradlew build
- name: Publish release package
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_repoUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_repoPassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
Expand Down
49 changes: 40 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,57 @@ plugins {
kotlin("kapt") version Versions.Kotlin apply false
kotlin("plugin.spring") version Versions.Kotlin apply false
id("io.spring.dependency-management") version Versions.DependencyManagement apply false
id("io.github.gradle-nexus.publish-plugin") version Versions.GradleNexusPublish
id("com.tencent.devops.release") version Versions.DevopsReleasePlugin
id("com.tencent.devops.publish") version Versions.DevopsReleasePlugin
}

val projectVersion = rootProject.file("version.txt").readText()

allprojects {
group = Release.Group
version = Release.Version
group = "com.tencent.devops"
version = projectVersion

apply(plugin = "com.tencent.devops.publish")

repositories {
mavenCentral()
jcenter()
gradlePluginPortal()
}
}

nexusPublishing {
repositories {
sonatype {
username.set(System.getenv("SONATYPE_USERNAME"))
password.set(System.getenv("SONATYPE_PASSWORD"))
publishing {
publications {
withType<MavenPublication> {
pom {
name.set(project.name)
description.set(project.description ?: project.name)
url.set("https://github.com/bkdevops-projects/devops-framework")
licenses {
license {
name.set("The MIT License (MIT)")
url.set("https://opensource.org/licenses/MIT")
}
}
organization {
name.set("Tencent BK-CI")
url.set("https://github.com/Tencent/bk-ci")
}
developers {
developer {
name.set("blueking")
email.set("contactus_bk@tencent.com")
url.set("https://github.com/TencentBlueKing")
roles.set(listOf("Java Developer"))
}
}
scm {
connection.set("scm:git:git://github.com/bkdevops-projects/devops-framework.git")
developerConnection.set("scm:git:ssh://github.com/bkdevops-projects/devops-framework.git")
url.set("https://github.com/bkdevops-projects/devops-framework")
}
}

}
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import java.io.File

object Release {
const val Group = "com.tencent.devops"
val Version = File("version.txt").readText().trim()
}

object Versions {
const val Jib: String = "3.2.0"
const val Java = "1.8"
Expand Down
77 changes: 0 additions & 77 deletions buildSrc/src/main/kotlin/publish.gradle.kts

This file was deleted.

1 change: 0 additions & 1 deletion devops-boot-project/devops-boot-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ subprojects {
apply(plugin = "org.jetbrains.kotlin.kapt")
apply(plugin = "org.jetbrains.kotlin.plugin.spring")
apply(plugin = "io.spring.dependency-management")
apply(plugin = "publish")

dependencyManagement {
imports {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
`java-platform`
id("publish")
}

description = "DevOps Boot Dependencies"
Expand Down
1 change: 0 additions & 1 deletion devops-boot-project/devops-boot-starters/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ description = "Starter for DevOps Boot"
subprojects {
apply(plugin = "java-library")
apply(plugin = "io.spring.dependency-management")
apply(plugin = "publish")

dependencyManagement {
imports {
Expand Down
1 change: 0 additions & 1 deletion devops-boot-project/devops-boot-tools/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ description = "Tools for DevOps Boot"

subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "publish")
}
2 changes: 1 addition & 1 deletion devops-boot-sample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("com.tencent.devops.boot") version File("../version.txt").readText().trim()
id("com.tencent.devops.boot")
}

allprojects {
Expand Down
7 changes: 7 additions & 0 deletions devops-boot-sample/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@

rootProject.name = "devops-boot-sample"


// for debug devops-boot locally
@Suppress("UnstableApiUsage")
pluginManagement {
val projectVersion = File(rootDir.parent,"version.txt").readText()
plugins {
id("com.tencent.devops.boot") version projectVersion
}
repositories {
mavenCentral()
gradlePluginPortal()
Expand Down
4 changes: 2 additions & 2 deletions docs/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ devops-framework/
### 环境变量准备
当需要发布到中央仓库时,会读取以下环境变量:

- `SONATYPE_USERNAME` sonatype用户名
- `SONATYPE_PASSWORD` sonatype密码
- `ORG_GRADLE_PROJECT_repoUsername` sonatype用户名
- `ORG_GRADLE_PROJECT_repoPassword` sonatype密码
- `ORG_GRADLE_PROJECT_signingKey` gpg签名key
- `ORG_GRADLE_PROJECT_signingKeyId` gpg签名key id
- `ORG_GRADLE_PROJECT_signingPassword` gpg签名密码
Expand Down
Loading