-
Notifications
You must be signed in to change notification settings - Fork 243
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
base: main
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -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 | ||
|
Comment on lines
+49
to
+52
|
||
|
|
||
| - 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 | ||
|
Comment on lines
+80
to
+85
|
||
|
|
||
| - name: Commit and push release version | ||
|
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. Can we have these 2 steps after maven release? that way if maven release fails, and we can easily retry. |
||
| 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 | ||
|
Comment on lines
+87
to
+99
|
||
|
|
||
| - 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.
Comment on lines
+101
to
+106
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 }} | ||
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