Skip to content

Commit 73f3203

Browse files
committed
Publish to Maven Central
1 parent 8e3b15f commit 73f3203

File tree

10 files changed

+53
-37
lines changed

10 files changed

+53
-37
lines changed

.github/workflows/publish.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish package to the Maven Central Repository
2+
on:
3+
release:
4+
types: [created]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Set up Java
11+
uses: actions/setup-java@v2
12+
with:
13+
java-version: '11'
14+
distribution: 'adopt'
15+
- name: Publish package
16+
run: gradle publish
17+
env:
18+
OSSRH_USER: ${{ secrets.OSSRH_USER }}
19+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
20+
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
21+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
build/
22
.gradle/
33
.idea/
4-
deploy.sh
4+
.local/
55
out/

.workbench/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
FROM ubuntu:focal
22

3-
RUN apt update && apt install -y sudo
3+
RUN apt update && apt install -y sudo openjdk-11-jdk-headless

bintray.gradle

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

build.gradle

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
plugins {
22
id "com.palantir.git-version" version "0.12.2"
3-
id "com.jfrog.bintray" version "1.8.4" apply false
4-
id "com.github.hierynomus.license" version "0.15.0" apply false
3+
id "com.github.hierynomus.license" version "0.16.1" apply false
54
}
65

76
def versionDetails = versionDetails()
@@ -17,8 +16,6 @@ ext {
1716
subprojects {
1817
apply plugin: "java"
1918
apply plugin: "java-library"
20-
apply plugin: "maven-publish"
21-
apply plugin: "com.jfrog.bintray"
2219

2320
sourceCompatibility = 1.8
2421
targetCompatibility = 1.8
@@ -30,10 +27,11 @@ subprojects {
3027

3128
version buildVersion
3229
apply from: "${rootProject.projectDir}/publishing.gradle"
33-
if (!version.endsWith("-SNAPSHOT")) {
34-
apply from: "${rootProject.projectDir}/bintray.gradle"
35-
} else {
36-
println "Not a tag build. Not configuring bintray."
30+
apply from: "${rootProject.projectDir}/signing.gradle"
31+
32+
java {
33+
withJavadocJar()
34+
withSourcesJar()
3735
}
3836

3937
test {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

proxybase/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ dependencies {
1111
testImplementation project(":cautils")
1212
testImplementation project(":testca")
1313
testImplementation 'org.mockito:mockito-core:2.23.4'
14-
testRuntime 'ch.qos.logback:logback-classic:1.2.3'
14+
testRuntimeOnly 'ch.qos.logback:logback-classic:1.2.3'
1515
}

publishing.gradle

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
apply plugin: "maven-publish"
2+
13
def scmUrl = 'https://github.com/dajudge/proxybase'
24
def pomConfig = {
35
licenses {
@@ -25,7 +27,7 @@ def projectArtifactId = project.name
2527
def projectVersion = project.version
2628
publishing {
2729
publications {
28-
ProxybasePublication(MavenPublication) {
30+
Proxybase(MavenPublication) {
2931
from components.java
3032
groupId projectGroupId
3133
artifactId projectArtifactId
@@ -39,6 +41,16 @@ publishing {
3941
}
4042
}
4143
}
44+
repositories {
45+
maven {
46+
name = "OSSRH"
47+
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2")
48+
credentials {
49+
username = System.getenv("OSSRH_USER") ?: "wrong"
50+
password = System.getenv("OSSRH_PASSWORD") ?: "credentials"
51+
}
52+
}
53+
}
4254
}
4355

4456
publishToMavenLocal.doFirst {

signing.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apply plugin: "signing"
2+
3+
signing {
4+
def signingKey = System.getenv("SIGNING_KEY") ?: ""
5+
def signingPwd = System.getenv("SIGNING_PASSWORD") ?: ""
6+
useInMemoryPgpKeys(signingKey, signingPwd)
7+
sign publishing.publications
8+
}

workbench

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

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

77
if [ "$#" -eq 0 ]; then
88
CMD=bash

0 commit comments

Comments
 (0)