Skip to content

Commit 22762b6

Browse files
committed
Add automatic version update script for README badges
1 parent 7b62cc1 commit 22762b6

2 files changed

Lines changed: 39 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Decompose Tutorial
22

3-
![Kotlin](https://img.shields.io/badge/kotlin-1.9.0-blue.svg?logo=kotlin)
4-
![Compose](https://img.shields.io/badge/Jetpack_Compose-Latest-green.svg?logo=jetpackcompose)
5-
![Decompose](https://img.shields.io/badge/Decompose-2.1.0-purple.svg)
3+
![Kotlin](https://img.shields.io/badge/kotlin-2.1.20-blue.svg?logo=kotlin)
4+
![Compose](https://img.shields.io/badge/Jetpack_Compose-2025.04.01-green.svg?logo=jetpackcompose)
5+
![Decompose](https://img.shields.io/badge/Decompose-3.3.0-purple.svg)
66

77
A comprehensive tutorial project showcasing **Decompose** for building reactive, component-based architectures in Kotlin Android development. This project demonstrates how to create modular, maintainable, and testable applications with proper separation of concerns.
88

update-readme-versions.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# ========================================================
4+
# Update README Versions Script
5+
# ========================================================
6+
# This script automatically extracts the latest library versions
7+
# from the gradle/libs.versions.toml file and updates the
8+
# badges in the README.md to reflect these versions.
9+
#
10+
# Run this script whenever you update dependencies to ensure
11+
# the README stays in sync with your actual project versions.
12+
# ========================================================
13+
14+
# Get the directory of the script
15+
SCRIPT_DIR=$(dirname "$0")
16+
cd "$SCRIPT_DIR" || exit 1
17+
18+
# Extract versions from the toml file
19+
KOTLIN_VERSION=$(grep -m 1 "kotlin =" gradle/libs.versions.toml | sed 's/kotlin = "\(.*\)"/\1/')
20+
DECOMPOSE_VERSION=$(grep -m 1 "decompose =" gradle/libs.versions.toml | sed 's/decompose = "\(.*\)"/\1/')
21+
COMPOSE_BOM_VERSION=$(grep -m 1 "composeBom =" gradle/libs.versions.toml | sed 's/composeBom = "\(.*\)"/\1/')
22+
23+
echo "Found versions:"
24+
echo "Kotlin: $KOTLIN_VERSION"
25+
echo "Decompose: $DECOMPOSE_VERSION"
26+
echo "Compose BOM: $COMPOSE_BOM_VERSION"
27+
28+
# Update README.md
29+
sed -i.bak -E "s/kotlin-[0-9]+\.[0-9]+\.[0-9]+-blue/kotlin-$KOTLIN_VERSION-blue/" README.md
30+
sed -i.bak -E "s/Decompose-[0-9]+\.[0-9]+\.[0-9]+-purple/Decompose-$DECOMPOSE_VERSION-purple/" README.md
31+
sed -i.bak -E "s/Jetpack_Compose-[^-]+-green/Jetpack_Compose-$COMPOSE_BOM_VERSION-green/" README.md
32+
33+
# Clean up backup file
34+
rm README.md.bak
35+
36+
echo "README.md has been updated with the latest versions!"

0 commit comments

Comments
 (0)