Skip to content

CODEOWNERS personalizations for jed326 (#15137) #1

CODEOWNERS personalizations for jed326 (#15137)

CODEOWNERS personalizations for jed326 (#15137) #1

Workflow file for this run

name: Increment Version
on:
workflow_dispatch:
inputs:
tag:
description: 'the tag'
required: true
type: string
push:
tags:
- '*.*.*'
permissions:
contents: write
issues: write
pull-requests: write
jobs:
build:
if: github.repository == 'opensearch-project/OpenSearch'
runs-on: ubuntu-latest
steps:
- name: Fetch tag and version information
run: |
TAG=$(echo "${GITHUB_REF#refs/*/}")
if [ -n ${{ github.event.inputs.tag }} ]; then
TAG=${{ github.event.inputs.tag }}
fi
CURRENT_VERSION_ARRAY=($(echo "$TAG" | tr . '\n'))
BASE=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:2}")
BASE_X=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:1}.x")
CURRENT_VERSION=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:3}")
CURRENT_VERSION_UNDERSCORE=$(IFS=_ ; echo "V_${CURRENT_VERSION_ARRAY[*]:0:3}")
CURRENT_VERSION_ARRAY[2]=$((CURRENT_VERSION_ARRAY[2]+1))
NEXT_VERSION=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:3}")
NEXT_VERSION_UNDERSCORE=$(IFS=_ ; echo "V_${CURRENT_VERSION_ARRAY[*]:0:3}")
if [[ ${#CURRENT_VERSION_ARRAY[2]} -gt 1 ]]; then
NEXT_VERSION_ID="${CURRENT_VERSION_ARRAY[0]:0:3}0${CURRENT_VERSION_ARRAY[1]:0:3}${CURRENT_VERSION_ARRAY[2]:0:3}99"
else
NEXT_VERSION_ID=$(IFS=0 ; echo "${CURRENT_VERSION_ARRAY[*]:0:3}99")
fi
echo "TAG=$TAG" >> $GITHUB_ENV
echo "BASE=$BASE" >> $GITHUB_ENV
echo "BASE_X=$BASE_X" >> $GITHUB_ENV
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
echo "CURRENT_VERSION_UNDERSCORE=$CURRENT_VERSION_UNDERSCORE" >> $GITHUB_ENV
echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_ENV
echo "NEXT_VERSION_UNDERSCORE=$NEXT_VERSION_UNDERSCORE" >> $GITHUB_ENV
echo "NEXT_VERSION_ID=$NEXT_VERSION_ID" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: ${{ env.BASE }}
- name: Increment Patch Version on Major.Minor branch
uses: peternied/opensearch-core-version-updater@v1
with:
previous-version: ${{ env.CURRENT_VERSION }}
new-version: ${{ env.NEXT_VERSION }}
update-current: true
- name: Create PR for BASE
id: base_pr
uses: peter-evans/create-pull-request@v6
with:
base: ${{ env.BASE }}
branch: 'create-pull-request/patch-${{ env.BASE }}'
commit-message: Increment version to ${{ env.NEXT_VERSION }}
signoff: true
delete-branch: true
labels: |
autocut
title: '[AUTO] Increment version to ${{ env.NEXT_VERSION }}.'
body: |
I've noticed that a new tag ${{ env.TAG }} was pushed, and incremented the version from ${{ env.CURRENT_VERSION }} to ${{ env.NEXT_VERSION }}.
- uses: actions/checkout@v4
with:
ref: ${{ env.BASE_X }}
- name: Add Patch Version on Major.X branch
uses: peternied/opensearch-core-version-updater@v1
with:
previous-version: ${{ env.CURRENT_VERSION }}
new-version: ${{ env.NEXT_VERSION }}
update-current: false
- name: Create PR for BASE_X
id: base_x_pr
uses: peter-evans/create-pull-request@v6
with:
base: ${{ env.BASE_X }}
branch: 'create-pull-request/patch-${{ env.BASE_X }}'
commit-message: Add bwc version ${{ env.NEXT_VERSION }}
signoff: true
delete-branch: true
labels: |
autocut
title: '[AUTO] [${{ env.BASE_X }}] Add bwc version ${{ env.NEXT_VERSION }}.'
body: |
I've noticed that a new tag ${{ env.TAG }} was pushed, and added a bwc version ${{ env.NEXT_VERSION }}.
- uses: actions/checkout@v4
with:
ref: main
- name: Add Patch Version on main branch
uses: peternied/opensearch-core-version-updater@v1
with:
previous-version: ${{ env.CURRENT_VERSION }}
new-version: ${{ env.NEXT_VERSION }}
update-current: false
- name: Create PR for main
id: main_pr
uses: peter-evans/create-pull-request@v6
with:
base: main
branch: 'create-pull-request/patch-main'
commit-message: Add bwc version ${{ env.NEXT_VERSION }}
signoff: true
delete-branch: true
labels: |
autocut
title: '[AUTO] [main] Add bwc version ${{ env.NEXT_VERSION }}.'
body: |
I've noticed that a new tag ${{ env.TAG }} was pushed, and added a bwc version ${{ env.NEXT_VERSION }}.
- name: Create tracking issue
id: create-issue
uses: actions/github-script@v7
with:
script: |
const body = `
### Description
A new version of OpenSearch was released, to prepare for the next release new version numbers need to be updated in all active branches of development.
### Exit Criteria
Review and merged the following pull requests
- [ ] ${{ steps.base_pr.outputs.pull-request-url }}
- [ ] ${{ steps.base_x_pr.outputs.pull-request-url }}
- [ ] ${{ steps.main_pr.outputs.pull-request-url }}
### Additional Context
See project wide guidance on branching and versions [[link]](https://github.com/opensearch-project/.github/blob/main/RELEASING.md).
`
const { data: issue }= await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["Build"],
title: "Increment version for ${{ env.NEXT_VERSION }}",
body: body
});
console.error(JSON.stringify(issue));
return issue.number;
result-encoding: string