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

feature: add auto version bump after release #186

Merged

Conversation

samuelorji
Copy link
Contributor

Description

Add a version workflow that gets the current version from the released tag, and then updates modules with a patch bump

Issues Resolved

#69

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

echo "TAG=$TAG" >> $GITHUB_ENV
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_ENV
sed -i '' -e "s/^version = \"$CURRENT_VERSION\"/version = \"$NEXT_VERSION\"/g" opensearch/Cargo.toml
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes that $CURRENT_VERSION is the recently released version and is what is already in Cargo.toml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or will it make sense to do a wildcard match:

sed -i '' -e "s/^version = \".*\"/version = \"$NEXT_VERSION\"/g" opensearch/Cargo.toml

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave this as $CURRENT_VERSION as a wildcard match like that could cause issues if we end up having a dependency definition in the below style:

[dependencies.tokio]
version = "1"
features = [ "macros" ]

Copy link
Contributor Author

@samuelorji samuelorji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My Github Actions knowledge isn't the best, happy to make necessary changes

Copy link
Collaborator

@Xtansia Xtansia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for having a go at this @samuelorji!

Just a couple minor fixes needed.

on:
push:
tags:
- '*.*.*'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version tags for the client start with a v

Suggested change
- '*.*.*'
- 'v*.*.*'

- uses: actions/checkout@v4
- name: Fetch and Update Version Information
run: |
TAG=$(echo "${GITHUB_REF#refs/*/}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To correctly handle tags starting with a v this needs a slight adjustment.

Suggested change
TAG=$(echo "${GITHUB_REF#refs/*/}")
TAG=$(echo "${GITHUB_REF#refs/*/v}")

echo "TAG=$TAG" >> $GITHUB_ENV
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_ENV
sed -i '' -e "s/^version = \"$CURRENT_VERSION\"/version = \"$NEXT_VERSION\"/g" opensearch/Cargo.toml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave this as $CURRENT_VERSION as a wildcard match like that could cause issues if we end up having a dependency definition in the below style:

[dependencies.tokio]
version = "1"
features = [ "macros" ]

echo "TAG=$TAG" >> $GITHUB_ENV
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_ENV
sed -i '' -e "s/^version = \"$CURRENT_VERSION\"/version = \"$NEXT_VERSION\"/g" opensearch/Cargo.toml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before actually making the changes to the Cargo.toml files, the workflow should checkout the correct base branch, like the reference workflow in OpenSearch core does. https://github.com/opensearch-project/OpenSearch/blob/main/.github/workflows/version.yml#L47-L52

Comment on lines 41 to 42
base: main
branch: 'create-pull-request/patch-main'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to above, this should target the correct base branch for the version rather than main.

The past versioning & branching hasn't been entirely consistent with this, but it is something we need to do going forward.

Signed-off-by: samuel orji <[email protected]>
@Xtansia Xtansia added the skip-changelog Skip changelog verification label Oct 1, 2023
@codecov
Copy link

codecov bot commented Oct 1, 2023

Codecov Report

Merging #186 (7a0b41a) into main (64f161d) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #186   +/-   ##
=======================================
  Coverage   73.86%   73.86%           
=======================================
  Files         401      401           
  Lines       63702    63702           
=======================================
  Hits        47055    47055           
  Misses      16647    16647           
Flag Coverage Δ
integration 73.86% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@Xtansia Xtansia merged commit 5a70fe5 into opensearch-project:main Oct 1, 2023
33 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OSCI-2023 skip-changelog Skip changelog verification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants