Skip to content

Commit

Permalink
Adds release workflows (#93)
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com>
  • Loading branch information
gaiksaya committed Jan 19, 2024
1 parent 7535a79 commit 2c6e1d4
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 3 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -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.
11 changes: 11 additions & 0 deletions jenkins/release.jenkinsFile
Original file line number Diff line number Diff line change
@@ -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')
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opensearch-cluster-cdk",
"version": "0.1.0",
"version": "1.0.0",
"bin": {
"cdk_v2": "bin/app.js"
},
Expand Down

0 comments on commit 2c6e1d4

Please sign in to comment.