From 1e506411125e7470eaded91103f58eff5f0a68dd Mon Sep 17 00:00:00 2001 From: Damian Jankowski Date: Mon, 26 Oct 2026 08:03:20 +0100 Subject: [PATCH] ci: bind central credentials to Central Portal for Maven 3.10 --- .github/workflows/maven-push-3.0.yml | 6 ++++++ .github/workflows/release-codegen-3.yml | 28 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/.github/workflows/maven-push-3.0.yml b/.github/workflows/maven-push-3.0.yml index 9e5b4593d1c..80da9c10b6a 100644 --- a/.github/workflows/maven-push-3.0.yml +++ b/.github/workflows/maven-push-3.0.yml @@ -33,6 +33,12 @@ jobs: with: repositories: '[{"id":"central-portal-snapshots","name":"Sonatype Central Portal snapshots","url":"https://central.sonatype.com/repository/maven-snapshots/","releases":{"enabled":false},"snapshots":{"enabled":true}}]' servers: '[{"id":"central","username":"${{ secrets.MAVEN_CENTRAL_USERNAME }}","password":"${{ secrets.MAVEN_CENTRAL_PASSWORD }}"}]' + - name: Bind central credentials to Central Portal + # Maven 3.10+ only sends server credentials to declared origins; without this, + # server id "central" is bound to repo.maven.apache.org and deploys get HTTP 401. + run: | + sed -i "s#central#centralhttps://central.sonatype.com#" "$HOME/.m2/settings.xml" + grep -q "https://central.sonatype.com" "$HOME/.m2/settings.xml" - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx diff --git a/.github/workflows/release-codegen-3.yml b/.github/workflows/release-codegen-3.yml index 1d47ff21ce9..637d8dda9ad 100644 --- a/.github/workflows/release-codegen-3.yml +++ b/.github/workflows/release-codegen-3.yml @@ -116,6 +116,13 @@ jobs: repositories: '[{"id":"central-portal-snapshots","name":"Sonatype Central Portal snapshots","url":"https://central.sonatype.com/repository/maven-snapshots/","releases":{"enabled":false},"snapshots":{"enabled":true}}]' servers: '[{"id":"central","username":"${{ secrets.MAVEN_CENTRAL_USERNAME }}","password":"${{ secrets.MAVEN_CENTRAL_PASSWORD }}"}]' + - name: Bind central credentials to Central Portal + # Maven 3.10+ only sends server credentials to declared origins; without this, + # server id "central" is bound to repo.maven.apache.org and deploys get HTTP 401. + run: | + sed -i "s#central#centralhttps://central.sonatype.com#" "$HOME/.m2/settings.xml" + grep -q "https://central.sonatype.com" "$HOME/.m2/settings.xml" + - name: Validate and resolve versions id: resolve # Computes build/deploy coordinates and enforces safe release preconditions. @@ -158,6 +165,13 @@ jobs: repositories: '[{"id":"central-portal-snapshots","name":"Sonatype Central Portal snapshots","url":"https://central.sonatype.com/repository/maven-snapshots/","releases":{"enabled":false},"snapshots":{"enabled":true}}]' servers: '[{"id":"central","username":"${{ secrets.MAVEN_CENTRAL_USERNAME }}","password":"${{ secrets.MAVEN_CENTRAL_PASSWORD }}"}]' + - name: Bind central credentials to Central Portal + # Maven 3.10+ only sends server credentials to declared origins; without this, + # server id "central" is bound to repo.maven.apache.org and deploys get HTTP 401. + run: | + sed -i "s#central#centralhttps://central.sonatype.com#" "$HOME/.m2/settings.xml" + grep -q "https://central.sonatype.com" "$HOME/.m2/settings.xml" + - name: Build codegen with bootstrap generators run: | bash CI/release/build-codegen-with-generators.sh "${{ needs.validate.outputs.bootstrap_generators_version }}" @@ -200,6 +214,13 @@ jobs: repositories: '[{"id":"central-portal-snapshots","name":"Sonatype Central Portal snapshots","url":"https://central.sonatype.com/repository/maven-snapshots/","releases":{"enabled":false},"snapshots":{"enabled":true}}]' servers: '[{"id":"central","username":"${{ secrets.MAVEN_CENTRAL_USERNAME }}","password":"${{ secrets.MAVEN_CENTRAL_PASSWORD }}"}]' + - name: Bind central credentials to Central Portal + # Maven 3.10+ only sends server credentials to declared origins; without this, + # server id "central" is bound to repo.maven.apache.org and deploys get HTTP 401. + run: | + sed -i "s#central#centralhttps://central.sonatype.com#" "$HOME/.m2/settings.xml" + grep -q "https://central.sonatype.com" "$HOME/.m2/settings.xml" + - name: Build swagger-codegen-generators run: | mvn -B -U clean install \ @@ -263,6 +284,13 @@ jobs: repositories: '[{"id":"central-portal-snapshots","name":"Sonatype Central Portal snapshots","url":"https://central.sonatype.com/repository/maven-snapshots/","releases":{"enabled":false},"snapshots":{"enabled":true}}]' servers: '[{"id":"central","username":"${{ secrets.MAVEN_CENTRAL_USERNAME }}","password":"${{ secrets.MAVEN_CENTRAL_PASSWORD }}"}]' + - name: Bind central credentials to Central Portal + # Maven 3.10+ only sends server credentials to declared origins; without this, + # server id "central" is bound to repo.maven.apache.org and deploys get HTTP 401. + run: | + sed -i "s#central#centralhttps://central.sonatype.com#" "$HOME/.m2/settings.xml" + grep -q "https://central.sonatype.com" "$HOME/.m2/settings.xml" + - name: Build swagger-codegen run: | bash CI/release/build-codegen-with-generators.sh "${{ needs.validate.outputs.codegen_build_generators_version }}"