-
Notifications
You must be signed in to change notification settings - Fork 242
fix: ensure release tag points to non-snapshot release commit #3582
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
Open
Lavanya-N24
wants to merge
3
commits into
operator-framework:main
Choose a base branch
from
Lavanya-N24:fix-release-tagging
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+85
−24
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,22 +9,31 @@ on: | |
| version_branch: | ||
| type: string | ||
| required: true | ||
| release_tag: | ||
| type: string | ||
| required: true | ||
|
|
||
| env: | ||
| # set the target pom to use the input directory as root | ||
| # set the target pom to use the input directory as root | ||
| MAVEN_ARGS: -V -ntp -e -f ${{ inputs.project_dir }}/pom.xml | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| release_sha: ${{ steps.resolve-sha.outputs.commit }} | ||
| steps: | ||
| - name: Checkout "${{inputs.version_branch}}" branch | ||
| uses: actions/checkout@v7 | ||
| - name: Checkout "${{ inputs.version_branch }}" branch | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: "${{inputs.version_branch}}" | ||
| ref: "${{ inputs.version_branch }}" | ||
|
|
||
| - name: Resolve checked-out commit | ||
| id: resolve-sha | ||
| run: echo "commit=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Set up Java and Maven | ||
| uses: actions/setup-java@v6 | ||
|
Collaborator
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. Same here this version should not be changed |
||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: 17 | ||
| distribution: temurin | ||
|
|
@@ -36,11 +45,11 @@ jobs: | |
| gpg-passphrase: MAVEN_GPG_PASSPHRASE | ||
|
|
||
| - name: Change version to release version | ||
| # Assume that RELEASE_VERSION will have form like: "v1.0.1". So we cut the "v" | ||
| run: | | ||
| ./mvnw ${MAVEN_ARGS} versions:set -DnewVersion="${RELEASE_VERSION:1}" versions:commit -DprocessAllModules | ||
| env: | ||
| RELEASE_VERSION: ${{ github.event.release.tag_name }} | ||
| RELEASE_TAG: ${{ inputs.release_tag }} | ||
| run: | | ||
| RELEASE_VERSION="${RELEASE_TAG#v}" | ||
| ./mvnw ${MAVEN_ARGS} versions:set -DnewVersion="${RELEASE_VERSION}" versions:commit -DprocessAllModules | ||
|
Lavanya-N24 marked this conversation as resolved.
|
||
|
|
||
| - name: Publish to Apache Maven Central | ||
| run: ./mvnw package deploy -Prelease | ||
|
|
@@ -49,19 +58,67 @@ jobs: | |
| MAVEN_CENTRAL_TOKEN: ${{ secrets.NEXUS_PASSWORD }} | ||
| MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
|
|
||
| # This is separate job because there were issues with git after release step, was not able to commit changes. | ||
| update-working-version: | ||
| finalize-release: | ||
| runs-on: ubuntu-latest | ||
| needs: publish | ||
| if: "!contains(github.event.release.tag_name, 'RC')" # not sure we should keep this the RC part | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout exact published commit | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: "${{ needs.publish.outputs.release_sha }}" | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Java and Maven | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: 17 | ||
| distribution: temurin | ||
| cache: 'maven' | ||
|
|
||
| - name: Change version to release version | ||
| env: | ||
| RELEASE_TAG: ${{ inputs.release_tag }} | ||
| run: | | ||
| RELEASE_VERSION="${RELEASE_TAG#v}" | ||
| ./mvnw ${MAVEN_ARGS} versions:set -DnewVersion="${RELEASE_VERSION}" versions:commit -DprocessAllModules | ||
|
Lavanya-N24 marked this conversation as resolved.
|
||
|
|
||
| - name: Commit and push release version | ||
|
Lavanya-N24 marked this conversation as resolved.
|
||
| env: | ||
| TARGET_BRANCH: ${{ inputs.version_branch }} | ||
| RELEASE_TAG: ${{ inputs.release_tag }} | ||
| run: | | ||
| git config --local user.email "action@github.com" | ||
| git config --local user.name "GitHub Action" | ||
| if git diff --quiet; then | ||
| echo "No version changes to commit." | ||
| else | ||
| git commit -am "Release ${RELEASE_TAG}" | ||
| git push origin HEAD:"${TARGET_BRANCH}" | ||
| fi | ||
|
Lavanya-N24 marked this conversation as resolved.
|
||
|
|
||
| - name: Override release tag to point to release commit | ||
| env: | ||
| RELEASE_TAG: ${{ inputs.release_tag }} | ||
| run: | | ||
| git tag -f -a "${RELEASE_TAG}" -m "Release ${RELEASE_TAG}" | ||
| git push -f origin "refs/tags/${RELEASE_TAG}" | ||
|
coderabbitai[bot] marked this conversation as resolved.
Lavanya-N24 marked this conversation as resolved.
Lavanya-N24 marked this conversation as resolved.
|
||
|
|
||
| update-working-version: | ||
| runs-on: ubuntu-latest | ||
| needs: finalize-release | ||
| permissions: | ||
| contents: write | ||
|
Lavanya-N24 marked this conversation as resolved.
|
||
| if: "!contains(inputs.release_tag, 'RC')" | ||
| steps: | ||
| - name: Checkout "${{inputs.version_branch}}" branch | ||
| uses: actions/checkout@v7 | ||
| - name: Checkout "${{ inputs.version_branch }}" branch | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: "${{inputs.version_branch}}" | ||
| ref: "${{ inputs.version_branch }}" | ||
|
|
||
| - name: Set up Java and Maven | ||
| uses: actions/setup-java@v6 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: 17 | ||
| distribution: temurin | ||
|
|
@@ -73,11 +130,9 @@ jobs: | |
| git config --local user.email "action@github.com" | ||
| git config --local user.name "GitHub Action" | ||
| git commit -m "Set new SNAPSHOT version into pom files." -a | ||
| env: | ||
| RELEASE_VERSION: ${{ github.event.release.tag_name }} | ||
|
|
||
| - name: Push changes to branch | ||
| uses: ad-m/github-push-action@master | ||
| uses: ad-m/github-push-action@881a6320fdb16eb5318c5054f31c218aec2b324c # v0.8.0 | ||
| with: | ||
| branch: "${{inputs.version_branch}}" | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| branch: "${{ inputs.version_branch }}" | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I guess this is a mistake, v7 should be the version we want to use
Uh oh!
There was an error while loading. Please reload this page.
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.
@Lavanya-N24 I still see the v4 here and other places
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.
@Lavanya-N24 these checkout action and other action versions are still wrong, should not be changed