Skip to content

Commit 4173492

Browse files
committed
setup maven central publishing
1 parent ea8ddfb commit 4173492

File tree

3 files changed

+98
-1
lines changed

3 files changed

+98
-1
lines changed
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: Set up JDK 18
14+
uses: actions/setup-java@v1
15+
with:
16+
java-version: 18
17+
- name: Prepare to publish
18+
run: |
19+
echo '${{secrets.GPG_PRIVATE_KEY}}' | base64 -d > publish_key.gpg
20+
gpg --quiet --batch --yes --decrypt --passphrase="${{secrets.SIGNING_PASSWORD}}" \
21+
--output secret.gpg publish_key.gpg
22+
echo "RELEASE_VERSION=$(echo ${GITHUB_REF:11})"
23+
- name: Publish with gradle
24+
uses: eskatos/gradle-command-action@v1
25+
env:
26+
SONATYPE_USERNAME: ${{secrets.SONATYPE_USERNAME}}
27+
SONATYPE_PASSWORD: ${{secrets.SONATYPE_PASSWORD}}
28+
with:
29+
gradle-version: current
30+
arguments: test publish -Psigning.secretKeyRingFile=secret.gpg -Psigning.keyId=${{secrets.SIGNING_KEYID}} -Psigning.password=${{secrets.SIGNING_PASSWORD}}

.idea/vcs.xml

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle

+61-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
group = 'ru.chrshnv'
6-
version = '1.0-SNAPSHOT'
6+
version = System.getenv('RELEASE_VERSION')
77

88
repositories {
99
mavenCentral()
@@ -22,3 +22,63 @@ test {
2222

2323
apply plugin: 'maven-publish'
2424
apply plugin: 'signing'
25+
26+
java {
27+
withJavadocJar()
28+
withSourcesJar()
29+
}
30+
31+
publishing {
32+
publications {
33+
maven(MavenPublication) {
34+
artifactId = "enot-io-sdk"
35+
groupId = "ru.chrshnv"
36+
version = "1.0.0"
37+
from components.java
38+
pom {
39+
packaging = "jar"
40+
name = "Enot IO SDK"
41+
description = "Enot IO SDK for API integration written on Java"
42+
url = "https://github.com/chrshnv/enot-io-java-sdk"
43+
44+
licenses {
45+
license {
46+
license {
47+
name = "The Apache License, Version 2.0"
48+
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
49+
}
50+
}
51+
}
52+
53+
scm {
54+
connection = "scm:https://github.com/chrshnv/enot-io-java-sdk.git"
55+
developerConnection = "scm:[email protected]:chrshnv/enot-io-java-sdk.git"
56+
url = "https://github.com/chrshnv/enot-io-java-sdk"
57+
}
58+
59+
developers {
60+
developer {
61+
id = "chrshnv"
62+
name = "Artemiy Degtyarev"
63+
64+
}
65+
}
66+
}
67+
}
68+
}
69+
70+
repositories {
71+
maven {
72+
name = "OSSRH"
73+
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
74+
credentials {
75+
username = System.getenv("SONATYPE_USERNAME")
76+
password = System.getenv("SONATYPE_PASSWORD")
77+
}
78+
}
79+
}
80+
}
81+
82+
signing {
83+
sign publishing.publications.maven
84+
}

0 commit comments

Comments
 (0)