From 2c6e1d41e83726bf14e4d6a6d26958cc84255192 Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad <61760125+gaiksaya@users.noreply.github.com> Date: Fri, 19 Jan 2024 11:32:08 -0800 Subject: [PATCH] Adds release workflows (#93) Signed-off-by: Sayali Gaikawad --- .github/workflows/release-drafter.yml | 33 +++++++++++++++++++++++++++ RELEASING.md | 17 ++++++++++++++ jenkins/release.jenkinsFile | 11 +++++++++ package-lock.json | 4 ++-- package.json | 2 +- 5 files changed, 64 insertions(+), 3 deletions(-) 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 00000000000..d8dd658bfb6 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,33 @@ +name: Draft a release + +on: + push: + tags: + - "*" + +jobs: + draft-a-release: + runs-on: ubuntu-latest + permissions: + contents: write + issues: write + steps: + - name: Checkout + 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=$(cat package.json | jq .version | tr -d "\"")" >> $GITHUB_OUTPUT + - uses: trstringer/manual-approval@v1 + with: + secret: ${{ github.TOKEN }} + approvers: ${{ steps.get_data.outputs.approvers }} + minimum-approvals: 2 + issue-title: 'Release opensearch-cluster-cdk : ${{ steps.get_data.outputs.version }}' + issue-body: "Please approve or deny the release of opensearch-cluster-cdk. **VERSION**: ${{ steps.get_data.outputs.version }} **TAG**: ${{ github.ref_name }} **COMMIT**: ${{ github.sha }}" + exclude-workflow-initiator-as-approver: true + - name: Release + uses: softprops/action-gh-release@v1 + with: + draft: true + generate_release_notes: true \ No newline at end of file diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 00000000000..25e0b66a76f --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,17 @@ +- [Overview](#overview) +- [Releasing](#releasing) + +## Overview + +This document explains the release strategy for artifacts in this organization. + +## 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. v2.1.0, and push it to the GitHub repo. +2. The [release-drafter.yml](.github/workflows/release-drafter.yml) will be automatically kicked off. +3. The above release drafter workflow creates an issue asking for confirmation about the release from the mainatiners. Once approved, it creates a draft release in the repository. +4. This draft release triggers the [jenkins release workflow](https://build.ci.opensearch.org/job/opensearch-cluster-cdk-release/) as a result of which opensearch-cluster-cdk is released on [npmjs](https://www.npmjs.com/package/@opensearch-project/opensearch-cluster-cdk). +5. Once the above release workflow is successful, the drafted release on GitHub is published automatically. +6. Increment "version" in package.json to the next patch release, e.g. v2.1.1. \ No newline at end of file diff --git a/jenkins/release.jenkinsFile b/jenkins/release.jenkinsFile new file mode 100644 index 00000000000..ed743d5b8f9 --- /dev/null +++ b/jenkins/release.jenkinsFile @@ -0,0 +1,11 @@ +lib = library(identifier: 'jenkins@6.0.0', retriever: modernSCM([ + $class: 'GitSCMSource', + remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', +])) + +standardReleasePipelineWithGenericTrigger( + tokenIdCredential: 'jenkins-opensearch-cluster-cdk-generic-webhook-token', + causeString: 'A tag was cut on opensearch-project/opensearch-cluster-cdk repository causing this workflow to run', + publishRelease: true) { + publishToNpm(publicationType: 'github') + } diff --git a/package-lock.json b/package-lock.json index fd5f2cccfa6..6b8016ec6e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "opensearch-cluster-cdk", - "version": "0.1.0", + "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "opensearch-cluster-cdk", - "version": "0.1.0", + "version": "1.0.0", "dependencies": { "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", diff --git a/package.json b/package.json index 91ae57e523e..dd72377234a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opensearch-cluster-cdk", - "version": "0.1.0", + "version": "1.0.0", "bin": { "cdk_v2": "bin/app.js" },