-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[publish] publishing signed artifacts with version computed from curr…
…ent branch/tag
- Loading branch information
1 parent
bfc961e
commit 1b754c0
Showing
26 changed files
with
408 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,32 @@ | ||
name: Release | ||
name: Publish package to the Maven Central Repository | ||
|
||
env: | ||
CI: true | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version' | ||
required: true | ||
release: | ||
types: [ created ] | ||
|
||
jobs: | ||
tagging: | ||
name: Release of [${{ github.event.inputs.version }}] | ||
publish_release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: release/${{ github.event.inputs.version }} | ||
fetch-depth: 0 | ||
|
||
- name: Config Git | ||
run: | | ||
git config user.name ${{ github.actor }} | ||
git config user.email "${{ github.actor }}@users.noreply.github.com" | ||
|
||
- name: Merge on master | ||
run: | | ||
git checkout master | ||
git merge --no-ff release/${{ github.event.inputs.version }} | ||
git push | ||
- name: Tag on master | ||
run: | | ||
git tag --annotate --message 'Release ${{ github.event.inputs.version }}' ${{ github.event.inputs.version }} | ||
git push origin ${{ github.event.inputs.version }} | ||
- name: Merge on develop | ||
run: | | ||
git checkout develop | ||
git merge --no-ff release/${{ github.event.inputs.version }} | ||
git push | ||
- name: Delete released branch | ||
run: git push origin :release/${{ github.event.inputs.version }} | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v3.1.0 | ||
|
||
- name: Publish package | ||
run: ./gradlew publish | ||
env: | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | ||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GNUPG_PRIVATE_KEY }} | ||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GNUPG_PASSPHRASE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rootProject.name = "buildSrc" |
98 changes: 98 additions & 0 deletions
98
buildSrc/src/main/kotlin/com.frogdevelopment.publish-conventions.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
plugins { | ||
java | ||
`maven-publish` | ||
signing | ||
} | ||
|
||
java { | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("mavenJava") { | ||
from(components["java"]) | ||
|
||
versionMapping { | ||
usage("java-api") { | ||
fromResolutionOf("runtimeClasspath") | ||
} | ||
usage("java-runtime") { | ||
fromResolutionResult() | ||
} | ||
} | ||
|
||
pom { | ||
description = project.description | ||
url = "https://github.com/FrogDevelopment/consul-populate/wiki" | ||
inceptionYear = "2024" | ||
issueManagement { | ||
system = "GitHub" | ||
url = "https://github.com/FrogDevelopment/consul-populate/issues" | ||
} | ||
developers { | ||
developer { | ||
id = "FrogDevelopper" | ||
name = "Le Gall Benoît" | ||
email = "legall.benoit@gmail.com" | ||
url = "https://github.com/FrogDevelopper" | ||
timezone = "Europe/Paris" | ||
} | ||
} | ||
licenses { | ||
license { | ||
name = "The Apache License, Version 2.0" | ||
url = "https://www.apache.org/licenses/LICENSE-2.0.txt" | ||
} | ||
} | ||
scm { | ||
connection = "scm:git:git://github.com/FrogDevelopment/consul-populate.git" | ||
developerConnection = "scm:git:ssh://github.com:FrogDevelopment/consul-populate.git" | ||
url = "https://github.com/FrogDevelopment/consul-populate/tree/master" | ||
} | ||
distributionManagement { | ||
downloadUrl = "https://github.com/FrogDevelopment/consul-populate/releases" | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name = "sonatype" | ||
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
credentials { | ||
username = System.getenv("OSSRH_USERNAME") | ||
password = System.getenv("OSSRH_TOKEN") | ||
} | ||
} | ||
|
||
maven { | ||
name = "github" | ||
url = uri("https://maven.pkg.github.com/FrogDevelopment/consul-populate") | ||
credentials { | ||
username = System.getenv("GITHUB_ACTOR") | ||
password = System.getenv("GITHUB_TOKEN") | ||
} | ||
} | ||
} | ||
} | ||
val releaseVersion = """^\d+\.\d+\.\d+$""".toRegex().matches(version.toString()) | ||
signing { | ||
if (releaseVersion) { | ||
val signingKey: String? by project | ||
val signingPassword: String? by project | ||
useInMemoryPgpKeys(signingKey, signingPassword) | ||
sign(publishing.publications["mavenJava"]) | ||
} | ||
} | ||
|
||
tasks { | ||
matching { it is PublishToMavenRepository && it.repository.name == "sonatype" }.all { | ||
onlyIf { releaseVersion } | ||
} | ||
matching { it is PublishToMavenRepository && it.repository.name == "github" }.all { | ||
onlyIf { !releaseVersion } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
consul-populate-core/src/main/java/com/frogdevelopment/consul/populate/PopulateService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
package com.frogdevelopment.consul.populate; | ||
|
||
/** | ||
* Entry point to run the data import | ||
* | ||
* @author Le Gall Benoît | ||
* @since 1.0.0 | ||
*/ | ||
public interface PopulateService { | ||
|
||
/** | ||
* Main method that is going to do the defined import into Consul's KV | ||
*/ | ||
void populate(); | ||
} |
Oops, something went wrong.