Skip to content

Commit 749abd7

Browse files
authored
* migration to central.sonatype, release scripts (#824)
* * migration to central.sonatype, release scripts using `central-publishing-maven-plugin` for maven and `org.jreleaser` for gradle. * * helper script to set versions * * github action to perform Release - manually triggered - changes version to Release one - builds everything - deploys to sonatype for staging - changes version to next development - uploads idea and eclipse plugins - creates draft release on github * * fixed: setversion.sh invocation * * fixed: missing `commit` in git invocation * * switched to actions/setup-java@v5, using `maven` cache * * investigating `gpg: signing failed: Inappropriate ioctl for device`, switched to macos-latest for test * * investigating `gpg: signing failed: Inappropriate ioctl for device`, GPG plugin version updated * * fixed: central validation - Project name is missing * * investigating gradle staging failed, added info disabled mvn for speedup * * investigating gradle staging failed, added URL to gradle plugin section * * WORKAROUND: for publishing gradle plugin marker to Maven Central * * fixed: do not force packaging to Jar as Plugin marker should have POM * * fix: next deployment version + restored maven deploy as final test * * final preparation: fixed idea plugin/gradle version wasn't set - workflow updated to deploy idea/eclipse plugins to releases AWS bucket
1 parent df78e21 commit 749abd7

File tree

14 files changed

+168
-63
lines changed

14 files changed

+168
-63
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v2
1616
- name: Set up JDK 17
17-
uses: actions/setup-java@v1
17+
uses: actions/setup-java@v5
1818
with:
19+
distribution: temurin
20+
cache: 'maven'
1921
java-version: '17'
2022

2123
- name: Install dependencies

.github/workflows/release.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ on:
1919
description: 'Release message'
2020
jobs:
2121
build:
22-
runs-on: macos-15
22+
runs-on: macos-latest
2323
env:
2424
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
2525
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
@@ -36,8 +36,10 @@ jobs:
3636
with:
3737
ref: ${{ github.event.inputs.targetBranch }}
3838
- name: Set up JDK 17
39-
uses: actions/setup-java@v1
39+
uses: actions/setup-java@v5
4040
with:
41+
distribution: temurin
42+
cache: 'maven'
4143
java-version: '17'
4244
server-id: sonatype-nexus-snapshots
4345
server-username: MAVEN_USERNAME
@@ -54,8 +56,8 @@ jobs:
5456
5557
- name: change version to release (and commit)
5658
run: |
57-
DEVELOPMENT_VERSION=$RELEASE_VERSION setversion.sh
58-
git -am "Set release version, $RELEASE_VERSION"
59+
DEVELOPMENT_VERSION=$RELEASE_VERSION ./setversion.sh
60+
git commit -am "Set release version, $RELEASE_VERSION"
5961
6062
- name: build natives
6163
run: ./build.sh
@@ -68,7 +70,7 @@ jobs:
6870

6971
- name: change version to next dev (and commit)
7072
run: |
71-
DEVELOPMENT_VERSION=NEXT_DEVELOPMENT_VERSION setversion.sh
73+
DEVELOPMENT_VERSION=$NEXT_DEVELOPMENT_VERSION ./setversion.sh
7274
git commit -am "Set next development version, $NEXT_DEVELOPMENT_VERSION"
7375
7476
- name: Configure AWS Credentials
@@ -79,10 +81,10 @@ jobs:
7981
aws-region: eu-west-3
8082

8183
- name: Deploy idea plugin
82-
run: aws s3 sync ./plugins/idea/build/distributions/ s3://${{ secrets.AWS_BUCKET }}/tmp_snapshots/idea --acl public-read --follow-symlinks --delete
84+
run: aws s3 sync ./plugins/idea/build/distributions/ s3://${{ secrets.AWS_BUCKET }}/releases/idea --acl public-read --follow-symlinks --delete
8385

8486
- name: Deploy eclipse plugin
85-
run: aws s3 sync ./plugins/eclipse/update-site/target/repository/ s3://${{ secrets.AWS_BUCKET }}/tmp_snapshots/eclipse --acl public-read --follow-symlinks --delete
87+
run: aws s3 sync ./plugins/eclipse/update-site/target/repository/ s3://${{ secrets.AWS_BUCKET }}/releases/eclipse --acl public-read --follow-symlinks --delete
8688

8789
- name: Create a draft release
8890
uses: ncipollo/release-action@v1

.github/workflows/snapshot.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v2
1919
- name: Set up JDK 17
20-
uses: actions/setup-java@v1
20+
uses: actions/setup-java@v5
2121
with:
22+
distribution: temurin
23+
cache: 'maven'
2224
java-version: '17'
2325
server-id: sonatype-nexus-snapshots
2426
server-username: MAVEN_USERNAME

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
set -e
33
mvn -T 10 clean install
44
./plugins/idea/gradlew -b plugins/idea/build.gradle clean buildPlugin
5-
mvn -f plugins/eclipse/pom.xml clean install
5+
mvn -T 10 -f plugins/eclipse/pom.xml clean install
66
./plugins/gradle/gradlew -b plugins/gradle/build.gradle clean assemble validatePlugins publishToMavenLocal

plugins/gradle/build.gradle

Lines changed: 82 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,21 @@ plugins {
44
id 'java-gradle-plugin'
55
id 'groovy'
66
id 'maven-publish'
7+
id "org.jreleaser" version "1.20.0"
78
id 'signing'
89
id 'eclipse'
910
}
1011

12+
ext {
13+
roboVMVersion = '2.3.24-SNAPSHOT'
14+
nexusUsername = System.getenv('MAVEN_USERNAME')
15+
nexusPassword = System.getenv('MAVEN_PASSWORD')
16+
}
1117

1218
group = 'com.mobidevelop.robovm'
1319
archivesBaseName = 'robovm-gradle-plugin'
14-
version = '2.3.24-SNAPSHOT'
20+
version "${roboVMVersion}"
21+
1522

1623
sourceCompatibility = 1.8
1724
targetCompatibility = 1.8
@@ -20,12 +27,6 @@ compileJava {
2027
options.compilerArgs.addAll(['--release', '8'])
2128
}
2229

23-
ext {
24-
roboVMVersion = '2.3.24-SNAPSHOT'
25-
nexusUsername = System.getenv('MAVEN_USERNAME')
26-
nexusPassword = System.getenv('MAVEN_PASSWORD')
27-
}
28-
2930
repositories {
3031
mavenLocal()
3132
mavenCentral()
@@ -60,50 +61,88 @@ gradlePlugin {
6061
}
6162

6263
publishing {
63-
publications {
64-
pluginMaven(MavenPublication) {
65-
pom {
66-
name = 'RoboVM Gradle Plugin'
67-
packaging = 'jar'
68-
description = 'The RoboVM Gradle Plugin provides a way to build RoboVM apps using Gradle.'
69-
url = 'https://github.com/mobidevelop/robovm/'
70-
inceptionYear = '2013'
71-
72-
scm {
73-
url = 'https://github.com/mobidevelop/robovm.git'
74-
connection = 'scm:git:git://github.com/mobidevelop/robovm.git'
75-
developerConnection = 'scm:git:[email protected]:mobidevelop/robovm.git'
76-
}
64+
// TODO: while not pushing to Gradle Plugin Portal but to Maven Central we need
65+
// to have complete POM with all fields to pass Cental validation
66+
// there is no way to configure URLs etc in gradlePlugin {} blocks,
67+
// so override both plugin marker's and plugin's POM in configureEach
68+
// instead of single `pluginMaven(MavenPublication)`
69+
publications.withType(MavenPublication).configureEach {
70+
pom {
71+
name = 'RoboVM Gradle Plugin'
72+
description = 'The RoboVM Gradle Plugin provides a way to build RoboVM apps using Gradle.'
73+
url = 'https://github.com/mobidevelop/robovm/'
74+
inceptionYear = '2013'
75+
76+
scm {
77+
url = 'https://github.com/mobidevelop/robovm.git'
78+
connection = 'scm:git:git://github.com/mobidevelop/robovm.git'
79+
developerConnection = 'scm:git:[email protected]:mobidevelop/robovm.git'
80+
}
7781

78-
licenses {
79-
license {
80-
name = 'The Apache Software License, Version 2.0'
81-
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
82-
distribution = 'repo'
83-
}
82+
licenses {
83+
license {
84+
name = 'The Apache Software License, Version 2.0'
85+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
86+
distribution = 'repo'
8487
}
88+
}
8589

86-
developers {
87-
developer {
88-
id = 'jtakakura'
89-
name = 'Junji Takakura'
90-
}
91-
developer {
92-
id = 'ntherning'
93-
name = 'Niklas Therning'
94-
}
90+
developers {
91+
developer {
92+
id = 'jtakakura'
93+
name = 'Junji Takakura'
94+
}
95+
developer {
96+
id = 'ntherning'
97+
name = 'Niklas Therning'
9598
}
9699
}
97100
}
98101
}
99102
repositories {
103+
if (project.version.toString().endsWith("-SNAPSHOT")) {
104+
// snapshots are going to sonatype
105+
maven {
106+
credentials {
107+
username = System.getenv("MAVEN_USERNAME")
108+
password = System.getenv("MAVEN_PASSWORD")
109+
}
110+
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
111+
}
112+
} else {
113+
// local staging repository for JReleaser
114+
maven {
115+
url = uri(layout.buildDirectory.dir("staging-deploy"))
116+
}
117+
}
118+
}
119+
}
120+
121+
122+
// https://central.sonatype.org/publish/publish-portal-gradle/
123+
jreleaser {
124+
signing {
125+
setActive("ALWAYS")
126+
armored = true
127+
}
128+
deploy {
100129
maven {
101-
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
102-
def snapshotsRepoUrl = "https://central.sonatype.com/repository/maven-snapshots/"
103-
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
104-
credentials {
105-
username = System.getenv("MAVEN_USERNAME")
106-
password = System.getenv("MAVEN_PASSWORD") }
130+
mavenCentral {
131+
create("sonatype") {
132+
setActive("RELEASE")
133+
username = System.getenv("MAVEN_USERNAME")
134+
password = System.getenv("MAVEN_PASSWORD")
135+
url = "https://central.sonatype.com/api/v1/publisher"
136+
stagingRepository("build/staging-deploy")
137+
setStage("UPLOAD") // OTHERWISE it will do "publish"
138+
}
139+
}
140+
}
141+
}
142+
release {
143+
github {
144+
skipRelease = true
145+
token = "-" // must be not blank
107146
}
108147
}
109148
}
@@ -127,7 +166,7 @@ tasks.withType(Javadoc) {
127166

128167
signing {
129168
required { !version.endsWith('SNAPSHOT') && gradle.taskGraph.hasTask("publish") }
130-
sign publishing.publications.pluginMaven
169+
sign publishing.publications.matching { it instanceof MavenPublication }
131170
}
132171

133172
assemble.dependsOn('shadowJar')
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-8.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

plugins/junit/client/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<version>2.3.24-SNAPSHOT</version>
99
</parent>
1010

11+
<name>RoboVM JUnit Client</name>
1112
<artifactId>robovm-junit-client</artifactId>
1213
<packaging>jar</packaging>
1314

plugins/junit/protocol/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<version>2.3.24-SNAPSHOT</version>
99
</parent>
1010

11+
<name>RoboVM JUnit Protocol</name>
1112
<artifactId>robovm-junit-protocol</artifactId>
1213
<packaging>jar</packaging>
1314

plugins/junit/server/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<version>2.3.24-SNAPSHOT</version>
99
</parent>
1010

11+
<name>RoboVM JUnit Server</name>
1112
<artifactId>robovm-junit-server</artifactId>
1213
<packaging>jar</packaging>
1314

plugins/maven/plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<plugin>
7777
<groupId>org.apache.maven.plugins</groupId>
7878
<artifactId>maven-plugin-plugin</artifactId>
79-
<version>3.6.0</version>
79+
<version>3.15.2</version>
8080
<configuration>
8181
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
8282
<goalPrefix>robovm</goalPrefix>

0 commit comments

Comments
 (0)