Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release drafter

on:
push:
tags:
- "*"

jobs:
draft-a-release:
name: Draft a release
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- id: get_data
run: |
echo "approvers=$(cat .github/CODEOWNERS | grep @ | tr -d '* ' | sed 's/@/,/g' | sed 's/,//1')" >> $GITHUB_OUTPUT
echo "version=$(./gradlew getVersion -Dbuild.snapshot=false -Dbuild -q | grep version= | cut -d'=' -f2)" >> $GITHUB_OUTPUT
- uses: trstringer/manual-approval@v1
with:
secret: ${{ github.TOKEN }}
approvers: ${{ steps.get_data.outputs.approvers }}
minimum-approvals: 2
issue-title: 'Release opensearch-sdk-java : ${{ steps.get_data.outputs.version }}'
issue-body: "Please approve or deny the release of opensearch-sdk-java. **VERSION**: ${{ steps.get_data.outputs.version }} **TAG**: ${{ github.ref_name }} **COMMIT**: ${{ github.sha }}"
exclude-workflow-initiator-as-approver: true
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'gradle'
- name: Build with Gradle
run: |
./gradlew --no-daemon -Dbuild.snapshot=false publishNebulaPublicationToLocalRepoRepository && tar -C build -cvf artifacts.tar.gz localRepo
- name: Draft a release
uses: softprops/action-gh-release@v1
with:
draft: true
generate_release_notes: true
files: |
artifacts.tar.gz
27 changes: 19 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ allprojects {
project.ext.licenseName = 'The Apache Software License, Version 2.0'
project.ext.licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
group = 'org.opensearch'
version = opensearch_version.tokenize('-')[0] + '.0'
version = '2.0.0'
if (buildVersionQualifier) {
version += "-${buildVersionQualifier}"
}
Expand All @@ -87,7 +87,6 @@ allprojects {


group 'org.opensearch.sdk'
version '2.0.0-SNAPSHOT'

publishing {
publications {
Expand All @@ -97,14 +96,20 @@ publishing {
}

repositories {
maven {
name = "Snapshots" // optional target repository name
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
credentials {
username "$System.env.SONATYPE_USERNAME"
password "$System.env.SONATYPE_PASSWORD"
if (version.toString().endsWith("SNAPSHOT")) {
maven {
name = "Snapshots" // optional target repository name
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
credentials {
username "$System.env.SONATYPE_USERNAME"
password "$System.env.SONATYPE_PASSWORD"
}
}
}
maven {
name = "localRepo"
url = "$buildDir/localRepo"
}
}
}

Expand Down Expand Up @@ -201,6 +206,12 @@ task helloWorld(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
}

task getVersion() {
doLast {
println("version=${version}")
}
}

test {
useJUnitPlatform()
jvmArgs '--enable-preview'
Expand Down