Skip to content

Commit

Permalink
Added a release workflow triggered on a tag.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Oct 22, 2024
1 parent 352e620 commit a964808
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 1 deletion.
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*.*.*"

Check failure on line 6 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote

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"

Check failure on line 37 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote

- 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

Check failure on line 59 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / lint

Unknown word: "softprops"
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

Check failure on line 75 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / lint

Unknown word: "nguyenvukhang"
id: version
with:
increment: "patch"

Check failure on line 78 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / lint

Must use plain style scalar

Check failure on line 78 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote
version-file: "spec/_info.yaml"

Check failure on line 79 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / lint

Must use plain style scalar

Check failure on line 79 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote
version-regex: "^version: (.*)"

Check failure on line 80 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote

- name: Update CHANGELOG to the Next Developer Iteration
uses: thomaseizinger/keep-a-changelog-new-release@v3

Check failure on line 83 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / lint

Unknown word: "thomaseizinger"
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

0 comments on commit a964808

Please sign in to comment.