diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000..84c4d0d9 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,31 @@ +name: Release drafter + +on: + push: + tags: + - "*" + +jobs: + draft-a-release: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + - name: Set up Python 3 + uses: actions/setup-python@v3 + with: + python-version: '3.x' + - name: Install build tools + run: | + python -m pip install --upgrade build + - name: Build project for distribution + run: | + python -m build + tar -zvcf artifacts.tar.gz dist + - name: 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 b8bb731c..0df5935c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added Point in time API rest API([#191](https://github.com/opensearch-project/opensearch-py/pull/191)) - Github workflow for changelog verification ([#218](https://github.com/opensearch-project/opensearch-py/pull/218)) - Added overload decorators to helpers-actions.pyi-"bulk" ([#239](https://github.com/opensearch-project/opensearch-py/pull/239)) +- Add release workflows ([#240](https://github.com/opensearch-project/opensearch-py/pull/240)) ### Changed - Updated getting started to user guide ([#233](https://github.com/opensearch-project/opensearch-py/pull/233)) - Updated CA certificate handling to check OpenSSL environment variables before defaulting to certifi ([#196](https://github.com/opensearch-project/opensearch-py/pull/196)) diff --git a/RELEASING.md b/RELEASING.md index 87d51e43..324c3d55 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -31,4 +31,10 @@ Repositories create consistent release labels, such as `v1.0.0`, `v1.1.0` and `v ## Releasing -The release process is standard across repositories in this org and is run by a release manager volunteering from amongst [MAINTAINERS](MAINTAINERS.md). \ No newline at end of file +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. +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/opensearch-py-release/) as a result of which opensearch-py client is released on [PyPi](https://pypi.org/project/opensearch-py/). +1. Once the above release workflow is successful, the drafted release on GitHub is published automatically. +1. Increment "version" in [_version.py](./opensearchpy/_version.py) to the next patch release, e.g. v2.1.1. See [example](https://github.com/opensearch-project/opensearch-py/pull/167). \ No newline at end of file diff --git a/jenkins/release.JenkinsFile b/jenkins/release.JenkinsFile new file mode 100644 index 00000000..3c285719 --- /dev/null +++ b/jenkins/release.JenkinsFile @@ -0,0 +1,12 @@ +lib = library(identifier: 'jenkins@1.3.1', retriever: modernSCM([ + $class: 'GitSCMSource', + remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', +])) + +standardReleasePipelineWithGenericTrigger( + tokenIdCredential: 'jenkins-opensearch-py-generic-webhook-token', + causeString: 'A tag was cut on opensearch-project/opensearch-py repository causing this workflow to run', + downloadReleaseAsset: true, + publishRelease: true) { + publishToPyPi(credentialId: 'jenkins-opensearch-py-pypi-credentials') + }