Skip to content

Commit ddb385f

Browse files
committed
Deploy: temporary maven.repository.credentialScope=id for Maven 3.10
Maven 3.10.0 on the runner image offers server credentials only to the origins bound to the server id. The id central is bound to repo.maven.apache.org, so the token is withheld from central.sonatype.com and the snapshot deploy fails with HTTP 401. credentialScope=id restores the id-only matching until setup-java releases mvn-server-repository-origins (actions/setup-java#1282, release asked in actions/setup-java#1284). Signed-off-by: Stefan Bischof <[email protected]>
1 parent e46158e commit ddb385f

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎.github/workflows/spec-build.yml‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,17 @@ jobs:
269269
echo "$v" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+-SNAPSHOT$' \
270270
|| { echo "::error::version '$v' is not a -SNAPSHOT — refusing scheduled deploy"; exit 1; }
271271
272+
# TEMPORARY -Dmaven.repository.credentialScope=id: Maven 3.10 (runner
273+
# image) offers server credentials only to the origins bound to the id,
274+
# and the id central is bound to repo.maven.apache.org, so the token
275+
# never reaches central.sonatype.com (HTTP 401). Remove it once
276+
# setup-java ships mvn-server-repository-origins (actions/setup-java#1282,
277+
# release asked in actions/setup-java#1284) and set
278+
# mvn-server-repository-origins: central:https://central.sonatype.com
272279
- name: Deploy SNAPSHOT (main variant)
273280
run: >-
274-
mvn -B -ntp -U -Pdeploy -Dgpg.skip=true -DskipTests deploy
281+
mvn -B -ntp -U -Pdeploy -Dgpg.skip=true -DskipTests
282+
-Dmaven.repository.credentialScope=id deploy
275283
env:
276284
CENTRAL_USERNAME: ${{ secrets.CENTRAL_SONATYPE_TOKEN_USERNAME }}
277285
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_TOKEN_PASSWORD }}

‎.github/workflows/spec-release.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ jobs:
4747
[ "$tag" = "$rev" ] \
4848
|| { echo "::error::tag '$tag' does not match version '$rev'"; exit 1; }
4949
50+
# TEMPORARY -Dmaven.repository.credentialScope=id, see the deploy job
51+
# of spec-build.yml
5052
- name: Build, test and deploy release
51-
run: mvn -B -ntp -U -Pdeploy deploy
53+
run: mvn -B -ntp -U -Pdeploy -Dmaven.repository.credentialScope=id deploy
5254
env:
5355
CENTRAL_USERNAME: ${{ secrets.CENTRAL_SONATYPE_TOKEN_USERNAME }}
5456
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_TOKEN_PASSWORD }}

0 commit comments

Comments
 (0)