From c171531bb51625023cef8da6e0b5fb270e7fd626 Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad <61760125+gaiksaya@users.noreply.github.com> Date: Fri, 13 Jan 2023 07:48:30 -0800 Subject: [PATCH] Adds release workflows to onboard to new release process (#321) * Add release workflows Signed-off-by: Sayali Gaikawad * Fix java Signed-off-by: Sayali Gaikawad * Add new release jenkinsFile Signed-off-by: Sayali Gaikawad * Modify releasing.md Signed-off-by: Sayali Gaikawad * Changelog Signed-off-by: Sayali Gaikawad * Fix changelog Signed-off-by: Sayali Gaikawad Signed-off-by: Sayali Gaikawad --- .github/workflows/release-drafter.yml | 28 ++++++++ CHANGELOG.md | 1 + RELEASING.md | 8 +-- jenkins/release.jenkinsFile | 16 +++++ jenkins/stage-maven-release.jenkinsfile | 90 ------------------------- 5 files changed, 47 insertions(+), 96 deletions(-) create mode 100644 .github/workflows/release-drafter.yml create mode 100644 jenkins/release.jenkinsFile delete mode 100644 jenkins/stage-maven-release.jenkinsfile diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000000..e3f52436b7 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,28 @@ +name: Release drafter + +on: + push: + tags: + - "*" + +jobs: + draft-a-release: + name: Draft a release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Build with Gradle + run: | + ./gradlew --no-daemon publishPublishMavenPublicationToLocalRepoRepository && tar -C build -cvf artifacts.tar.gz repository + - name: Draft a release + uses: softprops/action-gh-release@v1 + with: + draft: true + generate_release_notes: true + files: | + artifacts.tar.gz diff --git a/CHANGELOG.md b/CHANGELOG.md index 07e7abc4de..6238750fb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Github workflow for changelog verification ([#239](https://github.com/opensearch-project/opensearch-java/pull/239)) - Github workflow for dependabot PRs ([#247](https://github.com/opensearch-project/opensearch-java/pull/247)) - Add javadoc link for the client ([#255](https://github.com/opensearch-project/opensearch-java/pull/255)) +- Add 1-click release workflows ([#321](https://github.com/opensearch-project/opensearch-java/pull/321)) ### Dependencies - Bumps `classgraph` from 4.8.149 to 4.8.154 diff --git a/RELEASING.md b/RELEASING.md index 14dac4c92e..0d0729e578 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -34,9 +34,5 @@ Repositories create consistent release labels, such as `v1.0.0`, `v1.1.0` and `v The release process is standard across repositories in this org and is run by a release manager volunteering from amongst [MAINTAINERS](MAINTAINERS.md). 1. Create a tag, e.g. `v2.1.0`, and push it to the GitHub repo. -2. The [opensearch-java-maven-sign-and-release/](https://build.ci.opensearch.org/job/opensearch-java-maven-sign-and-release/) will be automatically kicked off. -3. Login to [AWS OSS Sonatype](https://aws.oss.sonatype.org/#stagingRepositories), and locate the staged release. -4. `Close` the staged repository, and ensure all checks pass. -5. `Release` the staged respository. -6. [Create a release on GitHub](https://github.com/opensearch-project/opensearch-java/releases/new) with release notes. -7. Increment `systemProp.version` in [gradle.properties](gradle.properties) to the next patch release, e.g. `v2.1.1`, commit and push. \ No newline at end of file +2. This creates a draft release which triggers the [opensearch-java-maven-sign-and-release/](https://build.ci.opensearch.org/job/opensearch-java-maven-sign-and-release/) jenkins workflow. The artifacts will be automcatically signed and published to maven. +3. Increment `systemProp.version` in [gradle.properties](gradle.properties) to the next patch release, e.g. `v2.1.1`, commit and push. \ No newline at end of file diff --git a/jenkins/release.jenkinsFile b/jenkins/release.jenkinsFile new file mode 100644 index 0000000000..d8289b3866 --- /dev/null +++ b/jenkins/release.jenkinsFile @@ -0,0 +1,16 @@ +lib = library(identifier: 'jenkins@1.5.3', retriever: modernSCM([ + $class: 'GitSCMSource', + remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', +])) + +standardReleasePipelineWithGenericTrigger( + tokenIdCredential: 'jenkins-opensearch-java-generic-webhook-token', + causeString: 'A tag was cut on opensearch-project/opensearch-java repository causing this workflow to run', + downloadReleaseAsset: true, + publishRelease: true) { + publishToMaven( + signingArtifactsPath: "$WORKSPACE/repository/", + mavenArtifactsPath: "$WORKSPACE/repository/", + autoPublish: true + ) + } diff --git a/jenkins/stage-maven-release.jenkinsfile b/jenkins/stage-maven-release.jenkinsfile deleted file mode 100644 index 80969ce215..0000000000 --- a/jenkins/stage-maven-release.jenkinsfile +++ /dev/null @@ -1,90 +0,0 @@ -lib = library(identifier: 'jenkins@main', retriever: modernSCM([ - $class: 'GitSCMSource', - remote: 'https://github.com/opensearch-project/opensearch-build.git', -])) - -pipeline { - options { - timeout(time: 30, unit: 'MINUTES') - throttleJobProperty( - categories: [], - limitOneJobWithMatchingParams: false, - maxConcurrentPerNode: 0, - maxConcurrentTotal: 1, - paramsToUseForLimit: '', - throttleEnabled: true, - throttleOption: 'project', - ) - } - agent { - docker { - label 'Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host' - image 'opensearchstaging/ci-runner:ci-runner-centos7-opensearch-build-v2' - args '-e JAVA_HOME=/opt/java/openjdk-11' - alwaysPull true - } - } - triggers { - GenericTrigger( - genericVariables: [ - [key: 'ref', value: '$.ref'], - [key: 'VERSION', value: '$.ref', regexpFilter: 'refs/tags/v' ], - ], - tokenCredentialId: 'jenkins-opensearch-java-generic-webhook-token', - causeString: 'A tag was cut on opensearch-project/opensearch-java repository causing this workflow to run', - printContributedVariables: false, - printPostContent: false, - regexpFilterText: '$ref', - regexpFilterExpression: '^refs/tags/.*' - ) - } - environment { - ARTIFACT_PATH = "$WORKSPACE/build/repository/org/opensearch/client/opensearch-java/$VERSION" - } - stages { - stage('Publish to Maven Local') { - steps { - // checkout the commit - checkout([ - $class: 'GitSCM', userRemoteConfigs: [[url: 'https://github.com/opensearch-project/opensearch-java.git']], - branches: [[name: "$ref"]] - ]) - - // publish maven artifacts - sh('./gradlew --no-daemon publishPublishMavenPublicationToLocalRepoRepository') - } - } - stage('Sign') { - steps { - script { - signArtifacts( - artifactPath: "${ARTIFACT_PATH}", - type: 'maven', - platform: 'linux' - ) - } - } - } - stage('Stage Maven Artifacts') { - environment { - REPO_URL = 'https://aws.oss.sonatype.org/' - STAGING_PROFILE_ID = "${SONATYPE_STAGING_PROFILE_ID}" - BUILD_ID = "${BUILD_NUMBER}" - } - steps { - // checkout the build repo - git url: 'https://github.com/opensearch-project/opensearch-build.git', branch: 'main' - - // stage artifacts for release with Sonatype - withCredentials([usernamePassword(credentialsId: 'jenkins-sonatype-creds', usernameVariable: 'SONATYPE_USERNAME', passwordVariable: 'SONATYPE_PASSWORD')]) { - sh('$WORKSPACE/publish/stage-maven-release.sh $WORKSPACE/build/repository/') - } - } - } - } - post { - always { - cleanWs disableDeferredWipeout: true, deleteDirs: true - } - } -}