Skip to content

Commit 5201dce

Browse files
Adding workflow to increment version after release (#664) (#671)
* Adding workflow to increment version after release on the 2.x branch * Added CHANGELOG --------- (cherry picked from commit 7d38fe5) Signed-off-by: Vacha Shah <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent b9ff4be commit 5201dce

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

Diff for: .github/workflows/increment-version.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Increment Version
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*'
7+
8+
permissions: {}
9+
jobs:
10+
build:
11+
if: github.repository == 'opensearch-project/opensearch-java'
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: GitHub App token
15+
id: github_app_token
16+
uses: tibdex/[email protected]
17+
with:
18+
app_id: ${{ secrets.APP_ID }}
19+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
20+
installation_id: 22958780
21+
22+
- uses: actions/checkout@v4
23+
- name: Fetch Tag and Version Information
24+
run: |
25+
TAG=$(echo "${GITHUB_REF#refs/*/}")
26+
CURRENT_VERSION_ARRAY=($(echo "${TAG//v}" | tr . '\n'))
27+
CURRENT_VERSION_ARRAY[0]=$((CURRENT_VERSION_ARRAY[0]//v))
28+
BASE_X=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:1}.x")
29+
CURRENT_VERSION=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:3}")
30+
CURRENT_VERSION_ARRAY[1]=$((CURRENT_VERSION_ARRAY[1]+1))
31+
NEXT_VERSION=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:3}")
32+
# if [[ ${#CURRENT_VERSION_ARRAY[2]} -gt 1 ]]; then
33+
# NEXT_VERSION_ID="${CURRENT_VERSION_ARRAY[0]:0:3}0${CURRENT_VERSION_ARRAY[1]:0:3}${CURRENT_VERSION_ARRAY[2]:0:3}99"
34+
# else
35+
# NEXT_VERSION_ID=$(IFS=0 ; echo "${CURRENT_VERSION_ARRAY[*]:0:3}99")
36+
# fi
37+
echo "TAG=$TAG" >> $GITHUB_ENV
38+
# echo "BASE=$BASE" >> $GITHUB_ENV
39+
echo "BASE_X=$BASE_X" >> $GITHUB_ENV
40+
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
41+
echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_ENV
42+
# echo "NEXT_VERSION_ID=$NEXT_VERSION_ID" >> $GITHUB_ENV
43+
- uses: actions/checkout@v4
44+
with:
45+
ref: ${{ env.BASE_X }}
46+
token: ${{ steps.github_app_token.outputs.token }}
47+
48+
- name: Increment Minor Version
49+
run: |
50+
echo Incrementing $CURRENT_VERSION to $NEXT_VERSION
51+
sed -i "s/systemProp.version = $CURRENT_VERSION/systemProp.version = $NEXT_VERSION/g" gradle.properties
52+
53+
- name: Create Pull Request
54+
uses: peter-evans/create-pull-request@v5
55+
with:
56+
token: ${{ steps.github_app_token.outputs.token }}
57+
base: ${{ env.BASE_X }}
58+
branch: 'create-pull-request/patch-${{ env.BASE }}'
59+
commit-message: Increment version to ${{ env.NEXT_VERSION }}
60+
signoff: true
61+
delete-branch: true
62+
labels: |
63+
autocut
64+
title: '[AUTO] Increment version to ${{ env.NEXT_VERSION }}.'
65+
body: |
66+
I've noticed that a new tag ${{ env.TAG }} was pushed, and incremented the version from ${{ env.CURRENT_VERSION }} to ${{ env.NEXT_VERSION }}.

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
2222
- Added support for wrapper queries ([#630](https://github.com/opensearch-project/opensearch-java/pull/630))
2323
- Added support for "script_fields" in multi search request ([#632](https://github.com/opensearch-project/opensearch-java/pull/632))
2424
- Added size attribute to MultiTermsAggregation ([#627](https://github.com/opensearch-project/opensearch-java/pull/627))
25+
- Added version increment workflow that executes after release ([#664](https://github.com/opensearch-project/opensearch-java/pull/664))
2526

2627
### Dependencies
2728
- Bumps `org.ajoberstar.grgit:grgit-gradle` from 5.0.0 to 5.2.0

0 commit comments

Comments
 (0)