From 8389ac81d096103d83043dc81364762b6b736e2e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 22 Feb 2023 17:32:11 +0000 Subject: [PATCH] Add workflow to publish maven snapshots (#6394) Signed-off-by: Sayali Gaikawad (cherry picked from commit 267e1621161d86045ad974a09425fc57fbc190a1) Signed-off-by: github-actions[bot] --- .github/workflows/publish-maven-snapshots.yml | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/publish-maven-snapshots.yml diff --git a/.github/workflows/publish-maven-snapshots.yml b/.github/workflows/publish-maven-snapshots.yml new file mode 100644 index 0000000000000..ca6e03936e8ed --- /dev/null +++ b/.github/workflows/publish-maven-snapshots.yml @@ -0,0 +1,39 @@ +name: Publish snapshots to maven + +on: + workflow_dispatch: + push: + branches: + - main + - '1.3' + - 2.x + +jobs: + build-and-publish-snapshots: + runs-on: ubuntu-latest + + permissions: + id-token: write + contents: write + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: adopt + java-version: 17 + + - name: Configure AWS credentials + 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 publishNebulaPublicationToSnapshotsRepository