Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: samuel orji <[email protected]>
  • Loading branch information
samuelorji committed Sep 29, 2023
1 parent e22e025 commit 7a0b41a
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Increment Version
on:
push:
tags:
- '*.*.*'
- 'v*.*.*'

permissions: {}
jobs:
Expand All @@ -22,14 +22,25 @@ jobs:
- uses: actions/checkout@v4
- name: Fetch and Update Version Information
run: |
TAG=$(echo "${GITHUB_REF#refs/*/}")
TAG=$(echo "${GITHUB_REF#refs/*/v}")
CURRENT_VERSION_ARRAY=($(echo "$TAG" | tr . '\n'))
BASE=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:2}")
CURRENT_VERSION=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:3}")
CURRENT_VERSION_ARRAY[2]=$((CURRENT_VERSION_ARRAY[2]+1))
NEXT_VERSION=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:3}")
echo "TAG=$TAG" >> $GITHUB_ENV
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_ENV
echo "BASE=$BASE" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: ${{ env.BASE }}
token: ${{ steps.github_app_token.outputs.token }}

- name: Increment Patch Version
run: |
echo Incrementing $CURRENT_VERSION to $NEXT_VERSION
sed -i '' -e "s/^version = \"$CURRENT_VERSION\"/version = \"$NEXT_VERSION\"/g" opensearch/Cargo.toml
sed -i '' -e "s/^version = \"$CURRENT_VERSION\"/version = \"$NEXT_VERSION\"/g" api_generator/Cargo.toml
sed -i '' -e "s/^version = \"$CURRENT_VERSION\"/version = \"$NEXT_VERSION\"/g" yaml_test_runner/Cargo.toml
Expand All @@ -38,8 +49,8 @@ jobs:
uses: peter-evans/create-pull-request@v3
with:
token: ${{ steps.github_app_token.outputs.token }}
base: main
branch: 'create-pull-request/patch-main'
base: ${{ env.BASE }}
branch: 'create-pull-request/patch- ${{ env.BASE }}'
commit-message: Increment version to ${{ env.NEXT_VERSION }}
signoff: true
delete-branch: true
Expand Down

0 comments on commit 7a0b41a

Please sign in to comment.