diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index ba482727..a36f8485 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -1,34 +1,35 @@ -name: Publish snapshots to maven - -on: - workflow_dispatch: - push: - branches: [ - main - 1.* - 2.* - ] - -jobs: - build-and-publish-snapshots: - runs-on: ubuntu-latest - permissions: - id-token: write - contents: write - steps: - - uses: actions/setup-java@v3 - with: - distribution: temurin # Temurin is a distribution of adoptium - java-version: 17 - - uses: actions/checkout@v3 - - uses: aws-actions/configure-aws-credentials@v1 - with: - role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }} - aws-region: us-east-1 - - name: publish snapshots to maven - run: | - export SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text) - export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text) - echo "::add-mask::$SONATYPE_USERNAME" - echo "::add-mask::$SONATYPE_PASSWORD" - ./gradlew publishPluginZipPublicationToSnapshotsRepository \ No newline at end of file +name: Publish snapshots to maven + +on: + workflow_dispatch: + push: + branches: + - main + - '[0-9]+.[0-9]+' + - '[0-9]+.x' +jobs: + build-and-publish-snapshots: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: write + steps: + - uses: actions/setup-java@v4 + with: + distribution: temurin # Temurin is a distribution of adoptium + java-version: 21 + - uses: actions/checkout@v4 + + - name: Load secret + uses: 1password/load-secrets-action@v2 + with: + # Export loaded secrets as environment variables + export-env: true + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username + SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password + + - name: publish snapshots to maven + run: | + ./gradlew publishPluginZipPublicationToSnapshotsRepository diff --git a/.github/workflows/security-knn-tests.yml b/.github/workflows/security-knn-tests.yml index 96c9c9cd..1d930f9e 100644 --- a/.github/workflows/security-knn-tests.yml +++ b/.github/workflows/security-knn-tests.yml @@ -31,7 +31,7 @@ jobs: opensearch_version=$(grep "System.getProperty(\"opensearch.version\", \"" build.gradle | grep '\([0-9]\|[.]\)\{5\}' -o) opensearch_version=$opensearch_version".0-SNAPSHOT" # we publish build artifacts to the below url - sec_plugin_url="https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/plugin/opensearch-security/"$opensearch_version"/" + sec_plugin_url="https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/org/opensearch/plugin/opensearch-security/"$opensearch_version"/" sec_st=$(curl -s -o /dev/null -w "%{http_code}" $sec_plugin_url) if [ "$sec_st" = "200" ]; then echo "isSecurityPluginAvailable=True" >> $GITHUB_OUTPUT @@ -40,7 +40,7 @@ jobs: echo "isSecurityPluginAvailable=False" >> $GITHUB_OUTPUT cat $GITHUB_OUTPUT fi - knn_plugin_url="https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/plugin/opensearch-knn/"$opensearch_version"/" + knn_plugin_url="https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/org/opensearch/plugin/opensearch-knn/"$opensearch_version"/" knn_st=$(curl -s -o /dev/null -w "%{http_code}" $knn_plugin_url) if [ "$knn_st" = "200" ]; then echo "isKnnPluginAvailable=True" >> $GITHUB_OUTPUT diff --git a/build.gradle b/build.gradle index 8174c163..6dc090da 100644 --- a/build.gradle +++ b/build.gradle @@ -71,6 +71,7 @@ buildscript { repositories { mavenLocal() mavenCentral() + maven { url "https://central.sonatype.com/repository/maven-snapshots/" } maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } maven { url "https://plugins.gradle.org/m2/" } maven { url "https://artifacts.opensearch.org/snapshots/lucene/" } @@ -155,6 +156,7 @@ dependencies { repositories { mavenLocal() mavenCentral() + maven { url "https://central.sonatype.com/repository/maven-snapshots/" } maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } maven { url "https://plugins.gradle.org/m2/" } maven { url "https://artifacts.opensearch.org/snapshots/lucene/" } @@ -978,7 +980,7 @@ publishing { repositories { maven { name = "Snapshots" - url = "https://aws.oss.sonatype.org/content/repositories/snapshots" + url = "https://central.sonatype.com/repository/maven-snapshots/" credentials { username "$System.env.SONATYPE_USERNAME" password "$System.env.SONATYPE_PASSWORD"