Skip to content

Commit

Permalink
Adding publish snapshots workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>
  • Loading branch information
harshavamsi committed May 15, 2023
1 parent 5dd79e6 commit bc7d33f
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Build and test hive

on: [push, pull_request]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Build and test MR

on: [push, pull_request]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Build and test spark

on: [push, pull_request]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Build and test spark 20

on: [push, pull_request]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Build and test spark 30

on: [push, pull_request]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Gradle Precommit
on: [pull_request]
on: [push,pull_request]

jobs:
precommit:
Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/publish_snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Publish snapshots to maven

on:
push:
branches:
- main

jobs:
build-and-publish-snapshots:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '8'
cache: 'gradle'

- name: 'Setup: Java 8 env'
run: echo "JAVA8_HOME=$JAVA_HOME" >> $GITHUB_ENV

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'gradle'

- name: 'Setup: Java 11 env'
run: echo "JAVA11_HOME=$JAVA_HOME" >> $GITHUB_ENV

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'

- name: 'Setup: Java 17 env'
run: echo "JAVA17_HOME=$JAVA_HOME" >> $GITHUB_ENV
- 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: Read value from Properties-file
id: read_property
uses: christian-draeger/read-properties@1.1.1
with:
path: 'buildSrc/opensearch-hadoop-version.properties'
properties: 'opensearch_hadoop'

- name: publish snapshots to build repositories
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 :opensearch-hadoop-mr:publishMainPublicationToBuildRepository
./gradlew :opensearch-hadoop-hive:publishMainPublicationToBuildRepository
./gradlew -S -Dbuild.snapshot=true -Dorg.gradle.warning.mode=summary distribution
- name: create snapshots maven folder and copy files
run: |
mkdir -p maven/org/opensearch/client
mkdir -p maven/org/opensearch/client/opensearch-hadoop/${{ steps.read_property.outputs.opensearch_hadoop }}
mkdir -p maven/org/opensearch/client/opensearch-spark-20_2.10/${{ steps.read_property.outputs.opensearch_hadoop }}
mkdir -p maven/org/opensearch/client/opensearch-spark-20_2.11/${{ steps.read_property.outputs.opensearch_hadoop }}
mkdir -p maven/org/opensearch/client/opensearch-spark-20_2.12/${{ steps.read_property.outputs.opensearch_hadoop }}
mkdir -p maven/org/opensearch/client/opensearch-spark-30_2.12/${{ steps.read_property.outputs.opensearch_hadoop }}
mkdir -p maven/org/opensearch/client/opensearch-spark-30_2.13/${{ steps.read_property.outputs.opensearch_hadoop }}
cp -R mr/build/repo/org/opensearch/client/ maven/org/opensearch/client/
cp -R hive/build/repo/org/opensearch/client/ maven/org/opensearch/client/
cp -R dist/build/distributions/ maven/org/opensearch/client/opensearch-hadoop/${{ steps.read_property.outputs.opensearch_hadoop }}
cp -R spark/sql-20/build/distributions/opensearch-spark-20_2.10* maven/org/opensearch/client/opensearch-spark-20_2.10/${{ steps.read_property.outputs.opensearch_hadoop }}
cp -R spark/sql-20/build/distributions/opensearch-spark-20_2.11* maven/org/opensearch/client/opensearch-spark-20_2.11/${{ steps.read_property.outputs.opensearch_hadoop }}
cp -R spark/sql-20/build/distributions/opensearch-spark-20_2.12* maven/org/opensearch/client/opensearch-spark-20_2.12/${{ steps.read_property.outputs.opensearch_hadoop }}
cp -R spark/sql-30/build/distributions/opensearch-spark-30_2.12* maven/org/opensearch/client/opensearch-spark-30_2.12/${{ steps.read_property.outputs.opensearch_hadoop }}
cp -R spark/sql-30/build/distributions/opensearch-spark-30_2.13* maven/org/opensearch/client/opensearch-spark-30_2.13/${{ steps.read_property.outputs.opensearch_hadoop }}
- uses: actions/checkout@v3
with:
repository: 'opensearch-project/opensearch-build'
path: 'build'

- name: publish snapshots to maven
run: |
build/publish-snapshot.sh maven

0 comments on commit bc7d33f

Please sign in to comment.