Skip to content

Commit c7fb0aa

Browse files
authored
Attempts to migrate to Sonatype's new publishing mechanism: attempt 0 (#8)
Signed-off-by: Laird Nelson <[email protected]>
1 parent 2af32bd commit c7fb0aa

File tree

5 files changed

+29
-80
lines changed

5 files changed

+29
-80
lines changed

.github/workflows/mvn-release-prepare-perform.yaml

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ jobs:
3636
distribution: 'temurin'
3737
gpg-passphrase: 'GPG_PASSPHRASE'
3838
gpg-private-key: '${{ secrets.GPG_PRIVATE_KEY }}'
39-
java-version: '23'
40-
mvn-toolchain-id: 'Temurin 23'
39+
java-version: '24'
40+
mvn-toolchain-id: 'Temurin 24'
4141
mvn-toolchain-vendor: 'openjdk' # see ../../pom.xml
42-
server-id: 'sonatype-oss-repository-hosting' # see https://github.com/microbean/microbean-parent/blob/master/pom.xml#L38
43-
server-password: 'SONATYPE_OSSRH_PASSWORD'
44-
server-username: 'SONATYPE_OSSRH_USERNAME'
42+
server-id: 'central.sonatype.com'
43+
server-password: 'CENTRAL_SONATYPE_COM_PASSWORD'
44+
server-username: 'CENTRAL_SONATYPE_COM_USERNAME'
4545
- id: 'setup-askpass'
4646
name: 'Step: Set Up GIT_ASKPASS'
4747
run: |
@@ -58,29 +58,28 @@ jobs:
5858
- id: 'mvn-release-prepare'
5959
name: 'Step: Maven Release: Prepare, Perform and Publish Site'
6060
env:
61+
CENTRAL_SONATYPE_COM_PASSWORD: '${{ secrets.CENTRAL_SONATYPE_COM_PASSWORD }}'
62+
CENTRAL_SONATYPE_COM_USERNAME: '${{ secrets.CENTRAL_SONATYPE_COM_USERNAME }}'
6163
DRY_RUN: '${{ inputs.dryRun }}'
6264
GIT_ASKPASS: '${{ runner.temp }}/.askpass'
6365
GPG_PASSPHRASE: '${{ secrets.GPG_PASSPHRASE }}'
6466
MVN_DEBUG: ${{ inputs.mvnDebug && '--debug' || '' }}
6567
MVN_TRANSFER_LOGGING: ${{ inputs.mvnTransferLogging && '' || '--no-transfer-progress' }}
6668
PUSH_TOKEN : '${{ secrets.PUSH_TOKEN }}' # critical; see ${GIT_ASKPASS} file
6769
SCM_GIT_HTTPS_URL: 'scm:git:${{ github.server_url }}/${{ github.repository }}.git'
68-
SONATYPE_OSSRH_PASSWORD: '${{ secrets.SONATYPE_OSSRH_PASSWORD }}'
69-
SONATYPE_OSSRH_STAGING_PROFILE_ID: '${{ vars.SONATYPE_OSSRH_STAGING_PROFILE_ID }}'
70-
SONATYPE_OSSRH_USERNAME: '${{ secrets.SONATYPE_OSSRH_USERNAME }}'
7170
shell: 'bash -e {0}'
7271
run: >
7372
git config --global user.email '[email protected]'
7473
7574
git config --global user.name 'microbean'
7675
7776
echo "::group::Running mvn prepare"
78-
77+
7978
./mvnw --batch-mode ${MVN_DEBUG} --errors ${MVN_TRANSFER_LOGGING} release:prepare
8079
-DdryRun="${DRY_RUN}"
8180
-Darguments="${MVN_TRANSFER_LOGGING}"
8281
-Dscm.url="${SCM_GIT_HTTPS_URL}"
83-
82+
8483
scm_tag="$(grep '^scm.tag=' release.properties | cut -f 2 -d =)"
8584
8685
echo "Prepared ${scm_tag}" >> "${GITHUB_STEP_SUMMARY}"
@@ -90,37 +89,13 @@ jobs:
9089
echo "::endgroup::"
9190
9291
echo "::group::Running mvn perform"
93-
94-
set +e
9592
96-
{
9793
./mvnw --batch-mode ${MVN_DEBUG} --errors ${MVN_TRANSFER_LOGGING} release:perform
98-
-Darguments="${MVN_TRANSFER_LOGGING} -Dscmpublish.dryRun=${DRY_RUN} -Dscmpublish.pubScmUrl=${SCM_GIT_HTTPS_URL} -DskipTests -DstagingProfileId=${SONATYPE_OSSRH_STAGING_PROFILE_ID}"
94+
-Darguments="${MVN_TRANSFER_LOGGING} -Dscmpublish.dryRun=${DRY_RUN} -Dscmpublish.pubScmUrl=${SCM_GIT_HTTPS_URL} -DskipTests -DautoPublish=true -DwaitUntil=published -DwaitMaxTime=3600"
9995
-DdryRun="${DRY_RUN}"
10096
-Dgoals="process-classes,post-site,scm-publish:publish-scm,deploy"
10197
-Dscm.url="${SCM_GIT_HTTPS_URL}"
102-
|
103-
tee /dev/fd/3
104-
|
105-
grep --invert-match --silent 'Java class com.sonatype.nexus.staging.api.dto.StagingProfileRepositoryDTO' || cat > /dev/null
106-
;
107-
}
108-
3>&1
10998
110-
exit_codes=(${PIPESTATUS[@]})
99+
echo "Released ${scm_tag} successfully" >> "${GITHUB_STEP_SUMMARY}";
111100
112101
echo "::endgroup::"
113-
114-
set -e
115-
116-
if [ "${exit_codes[2]}" -ne 0 ] ; then
117-
# grep "failed" (found com.sonatype.nexus.staging.api.dto.StagingProfileRepositoryDTO) and mvn failed
118-
echo "Released ${scm_tag} successfully, but verify that the staging repository was successfully released" >> "${GITHUB_STEP_SUMMARY}";
119-
# Treat this as a successful run
120-
exit 0;
121-
elif [ "${exit_codes[0]}" -eq 0 ] ; then
122-
# mvn succeeded and grep "succeeded" (did not find com.sonatype.nexus.staging.api.dto.StagingProfileRepositoryDTO)
123-
echo "Released ${scm_tag} successfully" >> "${GITHUB_STEP_SUMMARY}";
124-
fi
125-
126-
exit "${exit_codes[0]}"

.github/workflows/mvn-verify.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
with:
2323
cache: 'maven'
2424
distribution: 'temurin'
25-
java-version: '23'
26-
mvn-toolchain-id: 'Temurin 23'
25+
java-version: '24'
26+
mvn-toolchain-id: 'Temurin 24'
2727
mvn-toolchain-vendor: 'openjdk' # see ../../pom.xml
2828
- id: 'mvn-verify'
2929
name: 'Step: Maven Verify'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dependency:
2727
<groupId>org.microbean</groupId>
2828
<artifactId>microbean-assign</artifactId>
2929
<!-- Always check https://search.maven.org/artifact/org.microbean/microbean-bean for up-to-date available versions. -->
30-
<version>0.0.6</version>
30+
<version>0.0.7</version>
3131
</dependency>
3232
```
3333

pom.xml

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,11 @@
5252
</issueManagement>
5353

5454
<distributionManagement>
55-
<repository>
56-
<id>sonatype-oss-repository-hosting</id>
57-
<!-- See https://central.sonatype.org/publish/publish-maven/#distribution-management-and-authentication -->
58-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
59-
</repository>
6055
<site>
6156
<id>Github Pages</id>
6257
<name>microBean™ Assign Site</name>
6358
<url>https://microbean.github.io/microbean-assign/</url>
6459
</site>
65-
<snapshotRepository>
66-
<id>sonatype-oss-repository-hosting</id>
67-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
68-
</snapshotRepository>
6960
</distributionManagement>
7061

7162
<properties>
@@ -89,7 +80,6 @@
8980
<releaseProfiles>deployment</releaseProfiles>
9081
<scmCommentPrefix>[maven-release-plugin] [skip ci]</scmCommentPrefix>
9182
<tagNameFormat>v@{project.version}</tagNameFormat>
92-
<useReleaseProfile>false</useReleaseProfile>
9383

9484
<!-- maven-scm-publish-plugin properties;
9585
see https://maven.apache.org/plugins/maven-scm-publish-plugin/publish-scm-mojo.html -->
@@ -101,12 +91,8 @@
10191
<maven.site.deploy.skip>true</maven.site.deploy.skip>
10292
<relativizeDecorationLinks>false</relativizeDecorationLinks>
10393

104-
<!-- nexus-staging-maven-plugin properties -->
105-
<!-- See https://github.com/sonatype/nexus-maven-plugins/blob/0aee3defb33cb133ff536aba59b11d32a368b1e6/staging/maven-plugin/src/main/java/org/sonatype/nexus/maven/staging/AbstractStagingMojo.java#L169-L175 -->
106-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
107-
<!-- <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl> -->
108-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
109-
<stagingProgressTimeoutMinutes>10</stagingProgressTimeoutMinutes>
94+
<!-- central-publishing-maven-plugin properties -->
95+
<deploymentName>${project.name} v${project.version}</deploymentName>
11096

11197
<!-- Other properties -->
11298
<project.build.sourceEncoding>UTF8</project.build.sourceEncoding>
@@ -125,7 +111,7 @@
125111
<dependency>
126112
<groupId>org.junit</groupId>
127113
<artifactId>junit-bom</artifactId>
128-
<version>5.13.1</version>
114+
<version>5.13.2</version>
129115
<type>pom</type>
130116
<scope>import</scope>
131117
</dependency>
@@ -135,19 +121,19 @@
135121
<dependency>
136122
<groupId>org.microbean</groupId>
137123
<artifactId>microbean-attributes</artifactId>
138-
<version>0.0.3</version>
124+
<version>0.0.5</version>
139125
</dependency>
140126

141127
<dependency>
142128
<groupId>org.microbean</groupId>
143129
<artifactId>microbean-constant</artifactId>
144-
<version>0.0.7</version>
130+
<version>0.0.8</version>
145131
</dependency>
146132

147133
<dependency>
148134
<groupId>org.microbean</groupId>
149135
<artifactId>microbean-construct</artifactId>
150-
<version>0.0.11</version>
136+
<version>0.0.15</version>
151137
</dependency>
152138

153139
</dependencies>
@@ -314,7 +300,7 @@
314300
<dependency>
315301
<groupId>com.puppycrawl.tools</groupId>
316302
<artifactId>checkstyle</artifactId>
317-
<version>10.12.6</version>
303+
<version>10.26.0</version>
318304
</dependency>
319305
</dependencies>
320306
</plugin>
@@ -357,7 +343,6 @@
357343
</plugin>
358344
<plugin>
359345
<artifactId>maven-gpg-plugin</artifactId>
360-
<!-- <version>3.1.0</version> -->
361346
<version>3.2.7</version>
362347
</plugin>
363348
<plugin>
@@ -402,7 +387,6 @@
402387
</plugin>
403388
<plugin>
404389
<artifactId>maven-release-plugin</artifactId>
405-
<!-- <version>3.0.0-M6</version> --> <!-- see https://issues.apache.org/jira/browse/MRELEASE-1038 -->
406390
<version>3.1.1</version>
407391
</plugin>
408392
<plugin>
@@ -444,7 +428,7 @@
444428
<plugin>
445429
<groupId>com.github.spotbugs</groupId>
446430
<artifactId>spotbugs-maven-plugin</artifactId>
447-
<version>4.9.3.0</version>
431+
<version>4.9.3.1</version>
448432
</plugin>
449433
<plugin>
450434
<groupId>org.codehaus.mojo</groupId>
@@ -457,22 +441,12 @@
457441
<version>3.3.1</version>
458442
</plugin>
459443
<plugin>
460-
<groupId>org.sonatype.plugins</groupId>
461-
<artifactId>nexus-staging-maven-plugin</artifactId>
462-
<version>1.6.13</version>
444+
<groupId>org.sonatype.central</groupId>
445+
<artifactId>central-publishing-maven-plugin</artifactId>
446+
<version>0.8.0</version>
463447
<extensions>true</extensions>
464-
<dependencies>
465-
<!-- https://issues.sonatype.org/browse/NEXUS-26993?focusedCommentId=1098136&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-1098136 -->
466-
<dependency>
467-
<groupId>com.thoughtworks.xstream</groupId>
468-
<artifactId>xstream</artifactId>
469-
<version>1.4.20</version>
470-
</dependency>
471-
</dependencies>
472448
<configuration>
473-
<serverId>sonatype-oss-repository-hosting</serverId>
474-
<nexusUrl>${nexusUrl}</nexusUrl>
475-
<autoReleaseAfterClose>${autoReleaseAfterClose}</autoReleaseAfterClose>
449+
<publishingServerId>central.sonatype.com</publishingServerId>
476450
</configuration>
477451
</plugin>
478452
</plugins>
@@ -518,8 +492,8 @@
518492
</configuration>
519493
</plugin>
520494
<plugin>
521-
<groupId>org.sonatype.plugins</groupId>
522-
<artifactId>nexus-staging-maven-plugin</artifactId>
495+
<groupId>org.sonatype.central</groupId>
496+
<artifactId>central-publishing-maven-plugin</artifactId>
523497
</plugin>
524498
</plugins>
525499

src/site/site.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<skin>
1414
<groupId>org.apache.maven.skins</groupId>
1515
<artifactId>maven-fluido-skin</artifactId>
16-
<version>2.0.0</version>
16+
<version>2.1.0</version>
1717
</skin>
1818
<body>
1919
<menu name="Documentation">

0 commit comments

Comments
 (0)