Skip to content

Conversation

bbaarriiss
Copy link
Contributor

@bbaarriiss bbaarriiss commented Sep 8, 2025


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

The Gradle and Maven dependency versions are not updated automatically on each release. We wanted to automate this.

Solutions

This PR introduces automation to keep the dependency snippets in README.md up to date with the latest release version.

Dependencies (Optional)

If there are some other pull requests related to this one (e.g. new releases of frameworks), specify them here.

Needs releases with:

Summary by CodeRabbit

  • Documentation

    • README now auto-updates dependency snippets (Gradle/Maven) to the latest released version, ensuring installation instructions are always current after each release.
  • Chores

    • Release pipeline enhanced to automatically update and push README version changes, committing only when updates are detected.

@bbaarriiss bbaarriiss requested a review from a team as a code owner September 8, 2025 12:53
Copy link

coderabbitai bot commented Sep 8, 2025

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/auto-update-versions-in-readme-on-release

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e66472 and d22904c.

📒 Files selected for processing (1)
  • .github/workflows/release.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: tests

@bbaarriiss bbaarriiss changed the title chore: Auto update versions in readme on release - WPB-19588 chore: Auto update versions in readme on release - #WPB-19588 Sep 8, 2025
Copy link
Member

@alexandreferris alexandreferris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition!

Just have a comment on adding the branch/target explicitly, just to avoid any possible issues, specially when running directly from CI/CD pipelines

bbaarriiss and others added 2 commits September 8, 2025 15:50
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@bbaarriiss
Copy link
Contributor Author

@coderabbitai help

Copy link

coderabbitai bot commented Sep 8, 2025

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit configuration file (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@bbaarriiss
Copy link
Contributor Author

@coderabbitai review

Copy link

coderabbitai bot commented Sep 8, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
.github/workflows/release.yml (1)

41-49: Fix push from detached HEAD; use tag_name consistently; skip when no diff.

As written, actions/checkout on release events yields a detached HEAD; pushing “origin main” can fail (no local main) and VERSION extraction is inconsistent with the previous step. Also push even when no changes wastes a CI cycle.

Apply the following:

  • Check out the default branch (avoids detached HEAD).
  • Use github.event.release.tag_name for VERSION.
  • Skip commit/push if README.md is unchanged.
  • Push HEAD to the repo’s default branch.
  • Ensure permissions: contents: write at job level.

Diffs:

@@
-jobs:
-  publish:
-    runs-on: ubuntu-24.04
+jobs:
+  publish:
+    runs-on: ubuntu-24.04
+    permissions:
+      contents: write
@@
-      - uses: actions/checkout@v5
+      - uses: actions/checkout@v5
+        with:
+          ref: ${{ github.event.repository.default_branch }}
+          fetch-depth: 0
@@
-      - name: Commit and push README.md update
-        run: |
-          VERSION=${GITHUB_REF#refs/tags/}
-          git config user.name "github-actions[bot]"
-          git config user.email "github-actions[bot]@users.noreply.github.com"
-          git add README.md
-          git commit -m "docs: Update README.md to version ${VERSION}" || echo "No changes to commit"
-          git push origin main
+      - name: Commit and push README.md update
+        run: |
+          set -euo pipefail
+          VERSION="${{ github.event.release.tag_name }}"
+          git config user.name "github-actions[bot]"
+          git config user.email "github-actions[bot]@users.noreply.github.com"
+          if git diff --quiet -- README.md; then
+            echo "No README.md changes to commit"
+            exit 0
+          fi
+          git add README.md
+          git commit -m "docs(readme): update dependency version to ${VERSION}"
+          git push origin HEAD:"${{ github.event.repository.default_branch }}"

Quick check script to validate the change picks up the release tag version in README:

#!/bin/bash
set -euo pipefail
VERSION="${{ github.event.release.tag_name }}"
echo "Expecting version: $VERSION"
rg -n "wire-apps-jvm-sdk" README.md -C1
rg -n "$VERSION" README.md || { echo "Version not found in README"; exit 1; }
🧹 Nitpick comments (2)
.github/workflows/release.yml (2)

25-26: Drop continue-on-error; let failures surface (or guard later step).

This masks real errors in the update step. Prefer removing it now that we can guard the commit/push step on “no changes.”

-        continue-on-error: true

33-33: Broaden Gradle pattern (handle single quotes).

README snippets often use single quotes; add a second sed to cover them.

-          sed -i -E 's|implementation\("com\.wire:wire-apps-jvm-sdk:[^"]+"\)|implementation("com.wire:wire-apps-jvm-sdk:'"$VERSION"'")|g' README.md
+          sed -i -E 's|implementation\("com\.wire:wire-apps-jvm-sdk:[^"]+"\)|implementation("com.wire:wire-apps-jvm-sdk:'"$VERSION"'")|g' README.md
+          sed -i -E "s|implementation\('com\.wire:wire-apps-jvm-sdk:[^']+'\)|implementation('com.wire:wire-apps-jvm-sdk:$VERSION')|g" README.md

Optional: replicate for api/compile/testImplementation if they appear in README.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e66472 and 7cd4f1c.

📒 Files selected for processing (1)
  • .github/workflows/release.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: tests
🔇 Additional comments (2)
.github/workflows/release.yml (2)

28-31: Good: use release tag_name and strict shell flags.

Deriving VERSION from github.event.release.tag_name and set -euo pipefail are correct.


35-40: Good scoping of Maven replacement.

Limiting the change to the com.wire + wire-apps-jvm-sdk block avoids touching unrelated tags.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/release.yml (1)

8-9: Grant write permission for pushes.

Without explicit permissions, GITHUB_TOKEN may be read-only and the push will fail.

Add under the publish job:

 jobs:
   publish:
+    permissions:
+      contents: write
     runs-on: ubuntu-24.04
♻️ Duplicate comments (1)
.github/workflows/release.yml (1)

41-53: Commit/push from detached HEAD can fail; switch to default branch before committing.

On release events checkout is usually at the tag (detached). Commit on detached HEAD and pushing to the default branch may be rejected (non-FF) if the branch advanced. Stash changes, check out the default branch, pop, then commit/push.

           set -euo pipefail
           VERSION="${{ github.event.release.tag_name }}"
+          VERSION=${VERSION#v}
           git config user.name "github-actions[bot]"
           git config user.email "github-actions[bot]@users.noreply.github.com"
-          if git diff --quiet -- README.md; then
+          if git diff --quiet -- README.md; then
             echo "No README.md changes to commit"
             exit 0
           fi
-          git add README.md
-          git commit -m "docs(readme): update dependency version to ${VERSION}"
-          git push origin HEAD:"${{ github.event.repository.default_branch }}"
+          # Move changes onto the default branch (avoid detached HEAD)
+          git stash push -u -m "readme-bump"
+          git fetch origin "${{ github.event.repository.default_branch }}" --depth=1
+          git checkout -B "${{ github.event.repository.default_branch }}" "origin/${{ github.event.repository.default_branch }}"
+          git stash pop
+          git add README.md
+          git commit -m "docs(readme): update dependency version to ${VERSION}"
+          # Rebase in case the branch advanced after fetch (no-op if up to date)
+          git pull --rebase origin "${{ github.event.repository.default_branch }}" || true
+          git push origin HEAD:"${{ github.event.repository.default_branch }}"
🧹 Nitpick comments (3)
.github/workflows/release.yml (3)

28-29: Strip optional leading 'v' from tag names.

Many releases are tagged like v1.2.3, while README snippets expect 1.2.3. Strip the prefix to avoid inserting the 'v'.

-          VERSION="${{ github.event.release.tag_name }}"
+          VERSION="${{ github.event.release.tag_name }}"
+          VERSION=${VERSION#v}

31-39: Broaden Gradle pattern to also match single quotes.

Covers both Groovy and Kotlin DSL snippets that may use single quotes.

-          sed -i -E 's|implementation\("com\.wire:wire-apps-jvm-sdk:[^"]+"\)|implementation("com.wire:wire-apps-jvm-sdk:'"$VERSION"'")|g' README.md
+          sed -i -E "s|implementation\((\"|')com\.wire:wire-apps-jvm-sdk:[^\"']+\1\)|implementation(\"com.wire:wire-apps-jvm-sdk:${VERSION}\")|g" README.md

25-53: Minor DRY: define VERSION once at job-level env.

Optional: set VERSION once and reuse in both steps.

   publish:
     runs-on: ubuntu-24.04
+    env:
+      VERSION: ${{ github.event.release.tag_name }}
 ...
-          VERSION="${{ github.event.release.tag_name }}"
-          VERSION=${VERSION#v}
+          VERSION=${VERSION#v}
 ...
-          VERSION="${{ github.event.release.tag_name }}"
-          VERSION=${VERSION#v}
+          VERSION=${VERSION#v}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e66472 and 4dadb47.

📒 Files selected for processing (1)
  • .github/workflows/release.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: tests
🔇 Additional comments (1)
.github/workflows/release.yml (1)

25-30: Good switch to tag_name and safe shell header.

Using github.event.release.tag_name and set -euo pipefail is the right call.

@bbaarriiss bbaarriiss self-assigned this Sep 9, 2025
@bbaarriiss bbaarriiss merged commit d9ddf58 into main Sep 9, 2025
3 checks passed
@bbaarriiss bbaarriiss deleted the chore/auto-update-versions-in-readme-on-release branch September 9, 2025 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants