-
Notifications
You must be signed in to change notification settings - Fork 0
chore: Auto update versions in readme on release - #WPB-19588 #184
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
chore: Auto update versions in readme on release - #WPB-19588 #184
Conversation
- Add a test file to try the logic
This reverts commit e040fdb.
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches🧪 Generate unit tests
Comment |
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.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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
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.
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
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@coderabbitai help |
ChatThere are 3 ways to chat with CodeRabbit:
CodeRabbit commands
Other keywords and placeholders
CodeRabbit configuration file (
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
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.
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.mdOptional: replicate for api/compile/testImplementation if they appear in README.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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.
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.
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
📒 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.
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764
The PR Description
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
Chores