-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,50 @@ | ||||||
name: Increment Version | ||||||
|
||||||
on: | ||||||
push: | ||||||
tags: | ||||||
- '*.*.*' | ||||||
|
||||||
permissions: {} | ||||||
jobs: | ||||||
build: | ||||||
if: github.repository == 'opensearch-project/opensearch-rs' | ||||||
runs-on: ubuntu-latest | ||||||
steps: | ||||||
- name: GitHub App token | ||||||
id: github_app_token | ||||||
uses: tibdex/[email protected] | ||||||
with: | ||||||
app_id: ${{ secrets.APP_ID }} | ||||||
private_key: ${{ secrets.APP_PRIVATE_KEY }} | ||||||
installation_id: 22958780 | ||||||
|
||||||
- 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 commentThe reason will be displayed to describe this comment to others. Learn more. To correctly handle tags starting with a
Suggested change
|
||||||
CURRENT_VERSION_ARRAY=($(echo "$TAG" | tr . '\n')) | ||||||
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 | ||||||
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 commentThe reason will be displayed to describe this comment to others. Learn more. This assumes that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or will it make sense to do a wildcard match:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leave this as [dependencies.tokio]
version = "1"
features = [ "macros" ] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before actually making the changes to the |
||||||
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 | ||||||
|
||||||
- name: Create Pull Request | ||||||
uses: peter-evans/create-pull-request@v3 | ||||||
with: | ||||||
token: ${{ steps.github_app_token.outputs.token }} | ||||||
base: main | ||||||
branch: 'create-pull-request/patch-main' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||||||
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 }}. |
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