Skip to content

Commit

Permalink
Publish to Maven Central
Browse files Browse the repository at this point in the history
  • Loading branch information
dajudge committed Jun 21, 2021
1 parent 8e3b15f commit 73f3203
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 37 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Publish package to the Maven Central Repository
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Publish package
run: gradle publish
env:
OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build/
.gradle/
.idea/
deploy.sh
.local/
out/
2 changes: 1 addition & 1 deletion .workbench/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM ubuntu:focal

RUN apt update && apt install -y sudo
RUN apt update && apt install -y sudo openjdk-11-jdk-headless
23 changes: 0 additions & 23 deletions bintray.gradle

This file was deleted.

14 changes: 6 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id "com.palantir.git-version" version "0.12.2"
id "com.jfrog.bintray" version "1.8.4" apply false
id "com.github.hierynomus.license" version "0.15.0" apply false
id "com.github.hierynomus.license" version "0.16.1" apply false
}

def versionDetails = versionDetails()
Expand All @@ -17,8 +16,6 @@ ext {
subprojects {
apply plugin: "java"
apply plugin: "java-library"
apply plugin: "maven-publish"
apply plugin: "com.jfrog.bintray"

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand All @@ -30,10 +27,11 @@ subprojects {

version buildVersion
apply from: "${rootProject.projectDir}/publishing.gradle"
if (!version.endsWith("-SNAPSHOT")) {
apply from: "${rootProject.projectDir}/bintray.gradle"
} else {
println "Not a tag build. Not configuring bintray."
apply from: "${rootProject.projectDir}/signing.gradle"

java {
withJavadocJar()
withSourcesJar()
}

test {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion proxybase/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ dependencies {
testImplementation project(":cautils")
testImplementation project(":testca")
testImplementation 'org.mockito:mockito-core:2.23.4'
testRuntime 'ch.qos.logback:logback-classic:1.2.3'
testRuntimeOnly 'ch.qos.logback:logback-classic:1.2.3'
}
14 changes: 13 additions & 1 deletion publishing.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
apply plugin: "maven-publish"

def scmUrl = 'https://github.com/dajudge/proxybase'
def pomConfig = {
licenses {
Expand Down Expand Up @@ -25,7 +27,7 @@ def projectArtifactId = project.name
def projectVersion = project.version
publishing {
publications {
ProxybasePublication(MavenPublication) {
Proxybase(MavenPublication) {
from components.java
groupId projectGroupId
artifactId projectArtifactId
Expand All @@ -39,6 +41,16 @@ publishing {
}
}
}
repositories {
maven {
name = "OSSRH"
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
username = System.getenv("OSSRH_USER") ?: "wrong"
password = System.getenv("OSSRH_PASSWORD") ?: "credentials"
}
}
}
}

publishToMavenLocal.doFirst {
Expand Down
8 changes: 8 additions & 0 deletions signing.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apply plugin: "signing"

signing {
def signingKey = System.getenv("SIGNING_KEY") ?: ""
def signingPwd = System.getenv("SIGNING_PASSWORD") ?: ""
useInMemoryPgpKeys(signingKey, signingPwd)
sign publishing.publications
}
2 changes: 1 addition & 1 deletion workbench
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

DIR="$(cd "$(dirname "$0")"; pwd)";

IMG="ubuntu:focal"
IMG="$(docker build -q $DIR/.workbench)"

if [ "$#" -eq 0 ]; then
CMD=bash
Expand Down

0 comments on commit 73f3203

Please sign in to comment.