@@ -69,12 +69,22 @@ jobs:
6969
7070 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
7171
72- - name : Set up JDK 8
73- uses : actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
74- with :
75- java-version : 8
76- distribution : corretto
77- cache : maven
72+ # Use the CodeBuild image's preinstalled Corretto 8. The image ships it at
73+ # $JAVA_8_HOME but defaults JAVA_HOME to Java 25, so point JAVA_HOME/PATH at
74+ # 8. Avoids actions/setup-java, which fetches from corretto.github.io +
75+ # corretto.aws, both blocked by the runner egress lock. $JAVA_8_HOME
76+ # resolves per-arch (x86_64/aarch64).
77+ - name : Use the runner image's preinstalled Corretto 8
78+ run : |
79+ echo "JAVA_HOME=$JAVA_8_HOME" >> "$GITHUB_ENV"
80+ echo "$JAVA_8_HOME/bin" >> "$GITHUB_PATH"
81+ "$JAVA_8_HOME/bin/java" -version
82+
83+ # Route all mvn resolution through the CodeArtifact mirror. Must precede
84+ # resolve-release-version, which invokes `mvn help:evaluate`. Ambient
85+ # CodeBuild runner-role creds supply the token; no OIDC step in this job.
86+ - name : Configure Maven CodeArtifact mirror
87+ uses : ./.github/actions/configure-maven-mirror
7888
7989 - name : Resolve and validate release version
8090 uses : ./.github/actions/resolve-release-version
@@ -112,6 +122,12 @@ jobs:
112122 ${{ env.MODULE }}/target/*-linux*.jar
113123 ${{ env.MODULE }}/target/classes/jni/*.so
114124
125+ # Remove the user settings holding the CodeArtifact mirror token once the
126+ # build is done. Ephemeral runner, so defence-in-depth, not load-bearing.
127+ - name : Scrub Maven settings
128+ if : always()
129+ run : rm -f "$HOME/.m2/settings.xml"
130+
115131 # Assemble all native builds and publish.
116132 release :
117133 needs : build-natives
@@ -123,12 +139,23 @@ jobs:
123139 with :
124140 fetch-depth : 0 # full history for tagging/pushing
125141
126- - name : Set up JDK 8
127- uses : actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
128- with :
129- java-version : 8
130- distribution : corretto
131- cache : maven
142+ # Use the CodeBuild image's preinstalled Corretto 8. The image ships it at
143+ # $JAVA_8_HOME but defaults JAVA_HOME to Java 25, so point JAVA_HOME/PATH at
144+ # 8. Avoids actions/setup-java, which fetches from corretto.github.io +
145+ # corretto.aws, both blocked by the runner egress lock. $JAVA_8_HOME
146+ # resolves per-arch (x86_64/aarch64).
147+ - name : Use the runner image's preinstalled Corretto 8
148+ run : |
149+ echo "JAVA_HOME=$JAVA_8_HOME" >> "$GITHUB_ENV"
150+ echo "$JAVA_8_HOME/bin" >> "$GITHUB_PATH"
151+ "$JAVA_8_HOME/bin/java" -version
152+
153+ # Route all mvn resolution through the CodeArtifact mirror. Must precede
154+ # resolve-release-version (which invokes `mvn help:evaluate`) and the OIDC
155+ # step (which would shadow the runner-role creds this needs). Runs on every
156+ # path, since dependency resolution happens on dry-runs too.
157+ - name : Configure Maven CodeArtifact mirror
158+ uses : ./.github/actions/configure-maven-mirror
132159
133160 - name : Resolve and validate release version
134161 uses : ./.github/actions/resolve-release-version
@@ -234,7 +261,11 @@ jobs:
234261 gpg --batch --import <<< "$GPG_PRIVATE_KEY"
235262 GPG_KEYNAME=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec:/ {print $5; exit}')
236263
237- # settings.xml with the Sonatype token (server id "central").
264+ # Global settings holding only the Sonatype "central" server for upload.
265+ # Passed to Maven as -gs (global) so it MERGES with the CodeArtifact
266+ # mirror in ~/.m2/settings.xml (user) that the mirror step wrote: deps
267+ # resolve through the mirror, upload goes to central, and the mirror
268+ # token stays in that user file instead of being re-passed here.
238269 {
239270 echo '<settings><servers><server>'
240271 echo "<id>central</id>"
@@ -243,9 +274,9 @@ jobs:
243274 echo '</server></servers></settings>'
244275 } > "$MAVEN_SETTINGS"
245276
246- # --- Publish ---
277+ # --- Publish --- (-gs: merge Sonatype creds with the ~/.m2 mirror)
247278 mvn deploy -Prelease -DskipTests -DmultiArch=false \
248- -s "$MAVEN_SETTINGS" \
279+ -gs "$MAVEN_SETTINGS" \
249280 -Dgpg.keyname="$GPG_KEYNAME" -Dgpg.passphrase="$GPG_PASSPHRASE" \
250281 --file "$MODULE/pom.xml"
251282
0 commit comments