-
Notifications
You must be signed in to change notification settings - Fork 34
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
feature: add auto version bump after release #186
Conversation
Signed-off-by: samuel orji <[email protected]>
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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" ]
There was a problem hiding this 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
There was a problem hiding this 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.
.github/workflows/version.yml
Outdated
on: | ||
push: | ||
tags: | ||
- '*.*.*' |
There was a problem hiding this comment.
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
- '*.*.*' | |
- 'v*.*.*' |
.github/workflows/version.yml
Outdated
- uses: actions/checkout@v4 | ||
- name: Fetch and Update Version Information | ||
run: | | ||
TAG=$(echo "${GITHUB_REF#refs/*/}") |
There was a problem hiding this comment.
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.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
.github/workflows/version.yml
Outdated
base: main | ||
branch: 'create-pull-request/patch-main' |
There was a problem hiding this comment.
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]>
Codecov Report
@@ Coverage Diff @@
## main #186 +/- ##
=======================================
Coverage 73.86% 73.86%
=======================================
Files 401 401
Lines 63702 63702
=======================================
Hits 47055 47055
Misses 16647 16647
Flags with carried forward coverage won't be shown. Click here to find out more. |
Description
Add a
version
workflow that gets the current version from the released tag, and then updates modules with a patch bumpIssues 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.