From 1115c45767fc10a09ed6fda89a3c792f924c3afa Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad <61760125+gaiksaya@users.noreply.github.com> Date: Thu, 5 Jan 2023 14:00:47 -0800 Subject: [PATCH] Add release workflows (#48) * Add release workflows Signed-off-by: Sayali Gaikawad * Add release documentation Signed-off-by: Sayali Gaikawad * Add release documentation Signed-off-by: Sayali Gaikawad * Modify version Signed-off-by: Sayali Gaikawad Signed-off-by: Sayali Gaikawad --- .github/workflows/release-drafter.yml | 31 +++++++++++++++++++++ RELEASING.md | 40 +++++++++++++++++++++++++++ jenkins/release.jenkinsFile | 16 +++++++++++ 3 files changed, 87 insertions(+) create mode 100644 .github/workflows/release-drafter.yml create mode 100644 RELEASING.md create mode 100644 jenkins/release.jenkinsFile diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..c8dea76 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,31 @@ +name: Release drafter + +# Push events to every tag not containing "/" +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@v3 + with: + java-version: 11 + distribution: 'temurin' + cache: gradle + - name: Build with Gradle + run: | + ./gradlew 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/RELEASING.md b/RELEASING.md new file mode 100644 index 0000000..4d44f54 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,40 @@ +- [Overview](#overview) +- [Branching](#branching) + - [Release Branching](#release-branching) + - [Feature Branches](#feature-branches) +- [Release Labels](#release-labels) +- [Releasing](#releasing) + +## Overview + +This document explains the release strategy for artifacts in this organization. + +## Branching + +### Release Branching + +Given the current major release of 1.0, projects in this organization maintain the following active branches. + +* **main**: The next _major_ release. This is the branch where all merges take place and code moves fast. +* **1.x**: The next _minor_ release. Once a change is merged into `main`, decide whether to backport it to `1.x`. +* **1.0**: The _current_ release. In between minor releases, only hotfixes (e.g. security) are backported to `1.0`. + +Label PRs with the next major version label (e.g. `v2.0.0.0`) and merge changes into `main`. Label PRs that you believe need to be backported as `backport 1.x` and `backport 1.0`. Backport PRs by checking out the versioned branch, cherry-pick changes and open a PR against each target backport branch. + +### Feature Branches + +Do not create branches in the upstream repo, use your fork, for the exception of long lasting feature branches that require active collaboration from multiple developers. Name feature branches `feature/`. Once the work is merged to `main`, please make sure to delete the feature branch. + +## Release Labels + +Repositories create consistent release labels, such as `v1.0.0`, `v1.1.0` and `v2.0.0`, as well as `patch` and `backport`. Use release labels to target an issue or a PR for a given release. + +## Releasing + +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. 1.0.0.0, and push it to this GitHub repository. +1. The [release-drafter.yml](.github/workflows/release-drafter.yml) will be automatically kicked off and a draft release will be created. +1. This draft release triggers the [jenkins release workflow](https://build.ci.opensearch.org/job/sql-jdbc-release) as a result of which the driver is released on [maven central](https://search.maven.org/search?q=org.opensearch.driver). Please note that the release workflow is triggered only if created release is in draft state. +1. Once the above release workflow is successful, the drafted release on GitHub is published automatically. +1. Increment "version" in [build.gradle](./build.gradle) to the next iteration, e.g. 1.0.0.1 See [example](https://github.com/opensearch-project/sql-jdbc/pull/11). \ No newline at end of file diff --git a/jenkins/release.jenkinsFile b/jenkins/release.jenkinsFile new file mode 100644 index 0000000..f31fa07 --- /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-sql-jdbc-generic-webhook-token', + causeString: 'A tag was cut on opensearch-project/sql-jdbc repository causing this workflow to run', + downloadReleaseAsset: true, + publishRelease: true) { + publishToMaven( + signingArtifactsPath: "$WORKSPACE/repository/", + mavenArtifactsPath: "$WORKSPACE/repository/", + autoPublish: true + ) + }