Skip to content

Commit 5a775ee

Browse files
committed
Add Maven Central release job
1 parent 45eb248 commit 5a775ee

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
name: Build
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
java_version: [8]
15+
os: [windows-latest]
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v1
20+
21+
- name: Set up JDK ${{ matrix.java_version }}
22+
uses: actions/setup-java@v1
23+
with:
24+
java-version: ${{ matrix.java_version }}
25+
26+
- name: Build with Gradle
27+
run: |
28+
./gradlew build javadoc asciidoc -PfailBuildOnCVSS=4
29+
30+
- name: Upload to bintray
31+
env:
32+
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
33+
BINTRAY_TOKEN: ${{ secrets.BINTRAY_TOKEN }}
34+
MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }}
35+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
36+
run: |
37+
./gradlew bintrayUpload

build.gradle

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ configure(webAuthn4JSpringSecurityLibraryProjects) {
5858
apply plugin: 'java-library'
5959
apply plugin: 'jacoco'
6060
apply plugin: "maven-publish"
61+
apply plugin: 'com.jfrog.bintray'
6162
apply plugin: "com.jfrog.artifactory"
6263

6364
javadoc {
@@ -147,6 +148,20 @@ configure(webAuthn4JSpringSecurityLibraryProjects) {
147148
def mavenCentralUser = getVariable('MAVEN_CENTRAL_USER', 'mavenCentralUser')
148149
def mavenCentralPassword = getVariable('MAVEN_CENTRAL_PASSWORD', 'mavenCentralPassword')
149150

151+
task bintrayGpgSign(){
152+
group = "publishing"
153+
doLast{
154+
signArtifactsOnBintray(bintrayUser, bintrayToken);
155+
}
156+
}
157+
158+
task bintrayMavenCentralSync(){
159+
group = "publishing"
160+
doLast{
161+
syncMavenCentralToBintray(bintrayUser, bintrayToken);
162+
}
163+
}
164+
150165
artifactory {
151166
contextUrl = 'http://oss.jfrog.org/artifactory/simple/'
152167
publish {
@@ -165,6 +180,35 @@ configure(webAuthn4JSpringSecurityLibraryProjects) {
165180
skip = !"${webAuthn4JSpringSecurityVersion}".endsWith("-SNAPSHOT") // Publish only when it is SNAPSHOT release
166181
}
167182

183+
bintray {
184+
user = bintrayUser
185+
key = bintrayToken
186+
configurations = ['archives']
187+
publish = true
188+
dryRun = !("${webAuthn4JSpringSecurityVersion}".endsWith(".RELEASE")) // Publish only when it is RELEASE release
189+
publications = ['standard']
190+
pkg {
191+
userOrg = "webauthn4j"
192+
repo = "webauthn4j"
193+
name = project.name
194+
desc = project.description
195+
licenses = ['Apache-2.0']
196+
vcsUrl = githubUrl
197+
version {
198+
name = "${webAuthn4JSpringSecurityVersion}"
199+
released = new Date()
200+
vcsTag = "${webAuthn4JSpringSecurityVersion}"
201+
gpg {
202+
sign = true
203+
}
204+
//Optional configuration for Maven Central sync of the version
205+
mavenCentralSync {
206+
user = mavenCentralUser
207+
password = mavenCentralPassword
208+
}
209+
}
210+
}
211+
}
168212
}
169213

170214
configure(sampleAppProjects) {

0 commit comments

Comments
 (0)