Skip to content

Commit 1d14638

Browse files
committed
Attempts to migrate to Sonatype's new publishing mechanism: attempt 0
Signed-off-by: Laird Nelson <[email protected]>
1 parent 871e418 commit 1d14638

File tree

6 files changed

+367
-139
lines changed

6 files changed

+367
-139
lines changed

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

Lines changed: 15 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ jobs:
3030
persist-credentials: false
3131
- id: 'setup-java'
3232
name: 'Step: Set Up Java and Maven'
33-
uses: 'actions/setup-java@v3'
33+
uses: 'actions/setup-java@v4'
3434
with:
3535
cache: 'maven'
3636
distribution: 'temurin'
3737
gpg-passphrase: 'GPG_PASSPHRASE'
3838
gpg-private-key: '${{ secrets.GPG_PRIVATE_KEY }}'
39-
java-version: '17'
40-
mvn-toolchain-id: 'Temurin 17'
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-
79-
mvn --batch-mode ${MVN_DEBUG} --errors ${MVN_TRANSFER_LOGGING} release:prepare
77+
78+
./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-
{
97-
mvn --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}"
93+
./mvnw --batch-mode ${MVN_DEBUG} --errors ${MVN_TRANSFER_LOGGING} release:perform
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}"
100-
-Dgoals="verify,post-site,scm-publish:publish-scm,deploy"
96+
-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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ jobs:
1818
persist-credentials: false
1919
- id: 'setup-java'
2020
name: 'Step: Set Up Java and Maven'
21-
uses: 'actions/setup-java@v3'
21+
uses: 'actions/setup-java@v4'
2222
with:
2323
cache: 'maven'
2424
distribution: 'temurin'
25-
java-version: '17'
26-
mvn-toolchain-id: 'Temurin 17'
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'
30-
run: 'mvn --batch-mode --color never --errors --no-transfer-progress -Dorg.slf4j.simpleLogger.defaultLogLevel=info verify'
30+
run: './mvnw --batch-mode --color never --errors --no-transfer-progress -Dorg.slf4j.simpleLogger.defaultLogLevel=info verify'

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ changes, regardless of project version and without notice.**
1616

1717
# Requirements
1818

19-
microBean™ Constant requires a Java runtime of version 17 or higher.
19+
microBean™ Constant requires a Java runtime of version 16 or higher.
2020

2121
# Installation
2222

@@ -28,7 +28,7 @@ dependency:
2828
<groupId>org.microbean</groupId>
2929
<artifactId>microbean-constant</artifactId>
3030
<!-- Always check https://search.maven.org/artifact/org.microbean/microbean-constant for up-to-date available versions. -->
31-
<version>0.0.5</version>
31+
<version>0.0.8</version>
3232
</dependency>
3333
```
3434

0 commit comments

Comments
 (0)