Skip to content

Commit

Permalink
feat: adding workflow for publishing artifacts to maven central
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Laptev <[email protected]>
  • Loading branch information
MikeLaptev authored and riverszhang89 committed Sep 25, 2024
1 parent 5e2a82b commit 521513b
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
54 changes: 54 additions & 0 deletions contrib/cdb2hibernatedialect/.gitub/workflows/publication.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: 'Publication'

on:
push:
branches:
- main
release:
types: [published]

jobs:
publish:
name: 'Publish'
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- name: 'Gradle'
run: |
echo 'org.gradle.caching=false' >> gradle.properties
echo 'org.gradle.configuration-cache=false' >> gradle.properties
- name: 'Build cdb2hibernatedialect'
run: |
./gradlew build
- name: 'Publish snapshot to OSSRH'
if: github.event_name == 'push'
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_KEY_PASSPHRASE }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }}
run: |
./gradlew \
publishMavenPublicationToSonatypeRepository \
closeSonatypeStagingRepository
- name: 'Publish release to OSSRH'
if: github.event_name == 'release' && github.event.action == 'published'
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_KEY_PASSPHRASE }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }}
run: |
./gradlew \
-Prelease \
publishMavenPublicationToSonatypeRepository \
closeAndReleaseSonatypeStagingRepository
19 changes: 19 additions & 0 deletions contrib/cdb2hibernatedialect/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@
* limitations under the License.
*/

import java.time.Duration

plugins {
id "java"
id "maven-publish"
id "signing"
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.8"
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
}

group = "com.bloomberg.comdb2"
Expand Down Expand Up @@ -68,3 +72,18 @@ publishing {
}
}
}

nexusPublishing {
repositories {
sonatype()
}
transitionCheckOptions {
maxRetries = 180
delayBetween = Duration.ofSeconds(10L)
}
}

signing {
sign(publishing.publications["maven"])
required = project.hasProperty("release")
}

0 comments on commit 521513b

Please sign in to comment.