-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Auto-increment next development iteration. #1816
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
Changes from all commits
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,95 @@ | ||
| name: Increment Version | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - '*.*.*' | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Fetch Tag and Version Information | ||
| run: | | ||
| TAG=$(echo "${GITHUB_REF#refs/*/}") | ||
| 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}") | ||
| NEXT_VERSION_ID=$(IFS=0 ; echo "${CURRENT_VERSION_ARRAY[*]:0:3}99") | ||
| 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@v2 | ||
| with: | ||
| ref: ${{ env.BASE }} | ||
| - name: Increment Patch Version | ||
| run: | | ||
| echo Incrementing $CURRENT_VERSION to $NEXT_VERSION | ||
| echo " - \"$CURRENT_VERSION\"" >> .ci/bwcVersions | ||
| sed -i "s/opensearch = $CURRENT_VERSION/opensearch = $NEXT_VERSION/g" buildSrc/version.properties | ||
| echo Adding $NEXT_VERSION_UNDERSCORE after $CURRENT_VERSION_UNDERSCORE | ||
| sed -i "s/public static final Version $CURRENT_VERSION_UNDERSCORE = new Version(\([[:digit:]]\+\)\(.*\));/\0\n public static final Version $NEXT_VERSION_UNDERSCORE = new Version($NEXT_VERSION_ID\2);/g" server/src/main/java/org/opensearch/Version.java | ||
| sed -i "s/CURRENT = $CURRENT_VERSION_UNDERSCORE;/CURRENT = $NEXT_VERSION_UNDERSCORE;/g" server/src/main/java/org/opensearch/Version.java | ||
| - name: Create Pull Request | ||
| uses: peter-evans/create-pull-request@v3 | ||
| with: | ||
| base: ${{ env.BASE }} | ||
| branch: 'create-pull-request/patch-${{ env.BASE }}' | ||
|
Member
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. The bot will have problems creating a branch on OpenSearch as it doesn't have permissions to create one. Only maintainers on OpenSearch can. To quickly test out:
The bot should have to create its own fork to solve this problem or we have to fiddle with the permissions.
Member
Author
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.
Member
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. Yup that should solve it.
Member
Author
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. On opensearch-build branch protection is only on "root" branches, "*". Can I just change it in this repo?
Member
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. I believe it was because of https://medium.com/cider-sec/bypassing-required-reviews-using-github-actions-6e1b29135cc7. I am in line with you to relax branch protection rules only to |
||
| commit-message: Incremented version to ${{ env.NEXT_VERSION }} | ||
| delete-branch: true | ||
| title: '[AUTO] Incremented 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@v2 | ||
| with: | ||
| ref: ${{ env.BASE_X }} | ||
| - name: Add bwc version to .X branch | ||
| run: | | ||
| echo Adding bwc version $NEXT_VERSION after $CURRENT_VERSION | ||
| sed -i "s/- \"$CURRENT_VERSION\"/\0\n - \"$NEXT_VERSION\"/g" .ci/bwcVersions | ||
| echo Adding $NEXT_VERSION_UNDERSCORE after $CURRENT_VERSION_UNDERSCORE | ||
| sed -i "s/public static final Version $CURRENT_VERSION_UNDERSCORE = new Version(\([[:digit:]]\+\)\(.*\));/\0\n public static final Version $NEXT_VERSION_UNDERSCORE = new Version($NEXT_VERSION_ID\2);/g" server/src/main/java/org/opensearch/Version.java | ||
| - name: Create Pull Request | ||
| uses: peter-evans/create-pull-request@v3 | ||
| with: | ||
| base: ${{ env.BASE_X }} | ||
| branch: 'create-pull-request/patch-${{ env.BASE_X }}' | ||
| commit-message: Added bwc version ${{ env.NEXT_VERSION }} | ||
| delete-branch: true | ||
| title: '[AUTO] [${{ env.BASE_X }}] Added 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@v2 | ||
| with: | ||
| ref: main | ||
| - name: Add bwc version to main branch | ||
| run: | | ||
| echo Adding bwc version $NEXT_VERSION after $CURRENT_VERSION | ||
| sed -i "s/- \"$CURRENT_VERSION\"/\0\n - \"$NEXT_VERSION\"/g" .ci/bwcVersions | ||
| echo Adding $NEXT_VERSION_UNDERSCORE after $CURRENT_VERSION_UNDERSCORE | ||
| sed -i "s/public static final Version $CURRENT_VERSION_UNDERSCORE = new Version(\([[:digit:]]\+\)\(.*\));/\0\n public static final Version $NEXT_VERSION_UNDERSCORE = new Version($NEXT_VERSION_ID\2);/g" server/src/main/java/org/opensearch/Version.java | ||
| - name: Create Pull Request | ||
| uses: peter-evans/create-pull-request@v3 | ||
| with: | ||
| base: main | ||
| branch: 'create-pull-request/patch-main' | ||
| commit-message: Added bwc version ${{ env.NEXT_VERSION }} | ||
| delete-branch: true | ||
|
Member
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. @VachaShah you could use this for auto-backport workflow.
Contributor
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. Thanks @saratvemulapalli ! I just created a PR to fix the auto-backport workflow. |
||
| title: '[AUTO] [main] Added 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 }}. | ||

Uh oh!
There was an error while loading. Please reload this page.