Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a release workflow triggered on a tag. #635

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .cspell
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Nanos
nbest
nfkc
ngram
nguyenvukhang
niofs
nmslib
nodeattrs
Expand Down Expand Up @@ -158,13 +159,15 @@ Rudnick
ruleset
scriptless
securityconfig
signoff
slowlog
Slowlog
slurpfile
smartcn
Smartcn
snapshotted
softmax
softprops
Sorani
sslinfo
stoptags
Expand All @@ -181,6 +184,7 @@ tenantinfo
termvectors
tfidf
Tfidf
thomaseizinger
Tika
tlbr
tokenfilters
Expand Down
99 changes: 99 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Draft a Release

on:
push:
tags:
- 'v*.*.*'

jobs:
draft-a-release:
name: Draft a Release
runs-on: ubuntu-latest
permissions: write-all

steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Get Current Version
id: current
run: |
echo version=$(yq .version spec/_info.yaml) >> "$GITHUB_OUTPUT"

- name: Check Version
run: |
echo current=v${{ steps.current.outputs.version }}
echo tag=${{ github.ref_name }}
if "v${{ steps.current.outputs.version }}" != "${{ github.ref_name }}"; then
echo "::error::Failing, reason: version ${{ steps.current.outputs.version }} does not match tag ${{ github.ref_name }}."
exit 1
else
echo "::notice::Found version ${{ steps.current.outputs.version }}, all good."
fi

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Build
run: npm ci && npm run merge

- name: Upload Artifacts
id: upload
uses: actions/upload-artifact@v4
with:
name: build
path: |
build/*

- name: Extract Changelog
id: changelog
uses: sean0x42/markdown-extract@v2
with:
file: CHANGELOG.md
pattern: Unreleased
no-print-matched-heading: true

- name: Draft a release
uses: softprops/action-gh-release@v2
id: release
with:
draft: true
generate_release_notes: false
tag_name: ${{ github.ref_name }}
body: |
${{ steps.changelog.outputs.markdown }}

### Links
- [Build Artifact](${{ steps.upload.outputs.artifact-url }})
files: |
LICENSE.txt
build/*

- name: Increment Version
uses: nguyenvukhang/semver-increment@v1
id: version
with:
increment: patch
version-file: spec/_info.yaml
version-regex: '^version: (.*)'

- name: Update CHANGELOG to the Next Developer Iteration
uses: thomaseizinger/keep-a-changelog-new-release@v3
with:
tag: ${{ github.ref_name }}

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Preparing for next developer iteration ${{ steps.version.outputs.version }}.'
signoff: true
branch: prepare-v-next
base: main
delete-branch: true
title: 'Preparing for next developer iteration, ${{ steps.version.outputs.version }}.'
body: |
I've drafted a release, [${{ github.ref_name }}](${{ steps.release.outputs.url }}), please verify and release it.
Preparing for the next developer iteration, ${{ steps.version.outputs.version }}.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added `404` response for `DELETE /{index}`, `GET /{index}/_doc/{id}`, `DELETE /{index}/_doc/{id}` ([#589](https://github.com/opensearch-project/opensearch-api-specification/pull/589))
- Added ability to pass `InlineScript` as a simple string ([#605](https://github.com/opensearch-project/opensearch-api-specification/pull/605))
- Added `config_id` and `config_id_list` to `/_plugins/_notifications/configs` query parameters ([#594](https://github.com/opensearch-project/opensearch-api-specification/pull/594))
- Added a release workflow triggered on a tag ([#635](https://github.com/opensearch-project/opensearch-api-specification/pull/635))

### Changed

Expand Down
28 changes: 28 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
- [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 opensearch-api-specification.

## Versioning

At this time this project follows minor semantic versioning, i.e. a breaking change is an increment from 0.1.0 to 0.2.0 and a non-breaking change is an increment from 0.1.0 to 0.1.1. A version 1.0 of the API specification will be released when the spec is known to be complete against any current version of OpenSearch.

## Branching

Given the early release stages of this repo we only maintain a **main** branch where all merges take place and code moves fast.

# Releasing

A release can be done by any [maintainer](MAINTAINERS.md).

1. Check out the [upstream repo](https://github.com/opensearch-project/opensearch-api-specification) and ensure the repo is up-to-date with `git pull origin main` and that you do not have any local changes.
2. Create a tag, e.g. `git tag v0.1.0`, and push it to GitHub with `git push origin --tags`.
3. The [release workflow](.github/workflows/release.yml) will be automatically kicked off, a draft release, and a pull request that increments the version in [spec/_info.yaml](spec/_info.yaml) will be created.
4. Verify and release the draft.
5. Approve, and merge the version increment pull request.
2 changes: 1 addition & 1 deletion spec/_info.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$schema: ./json_schemas/_info.schema.yaml

title: OpenSearch API Specification
version: 1.0.0
version: 0.1.0
x-api-version: 2.16.0
Loading