feat(workflow): automate README badge version updates

- Add automatic README.md badge update to publish workflow
- Update workflow to handle 6 files instead of 5
- Sync README badge to match current version (0.1.4)

This ensures version badges stay in sync across all releases
without manual intervention.
This commit is contained in:
Vijay Janapa Reddi
2026-01-19 11:09:35 -05:00
parent 1d658fa5d7
commit a6fff2c277
2 changed files with 17 additions and 3 deletions

View File

@@ -17,12 +17,13 @@ name: 🔥 TinyTorch Publish (Live)
# └─ Run tinytorch-ci.yml tests
#
# 3. update-version (if preflight passes)
# └─ Bump version in 5 files on dev branch:
# └─ Bump version in 6 files on dev branch:
# - tinytorch/__init__.py
# - pyproject.toml
# - site/_static/version-badge.js
# - site/extra/install.sh
# - site/_static/announcement.json
# - README.md
#
# 4. sync-from-dev
# └─ Merge dev → main
@@ -253,12 +254,25 @@ jobs:
echo "✅ announcement.json updated"
cat tinytorch/site/_static/announcement.json
- name: 📝 Update README badge
run: |
echo "📝 Updating version badge in tinytorch/README.md..."
VERSION_NUM="${{ needs.validate-inputs.outputs.new_version }}"
VERSION_NUM=${VERSION_NUM#tinytorch-v}
# Update version badge in README.md
sed -i "s/version-[0-9.]*-D4740C/version-$VERSION_NUM-D4740C/" tinytorch/README.md
echo "✅ README.md badge updated"
grep "version-" tinytorch/README.md | head -1
- name: 💾 Commit version update
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add tinytorch/tinytorch/__init__.py tinytorch/pyproject.toml tinytorch/site/_static/version-badge.js tinytorch/site/extra/install.sh tinytorch/site/_static/announcement.json
git add tinytorch/tinytorch/__init__.py tinytorch/pyproject.toml tinytorch/site/_static/version-badge.js tinytorch/site/extra/install.sh tinytorch/site/_static/announcement.json tinytorch/README.md
git commit -m "chore(tinytorch): bump version to ${{ needs.validate-inputs.outputs.new_version }}" || echo "No changes to commit"
git push origin dev

View File

@@ -4,7 +4,7 @@
### Build Your Own ML Framework From Scratch
[![Version](https://img.shields.io/badge/version-0.1.1-D4740C?logo=fireship&logoColor=white)](https://github.com/harvard-edge/cs249r_book/releases?q=tinytorch)
[![Version](https://img.shields.io/badge/version-0.1.4-D4740C?logo=fireship&logoColor=white)](https://github.com/harvard-edge/cs249r_book/releases?q=tinytorch)
[![Status](https://img.shields.io/badge/status-preview-orange?logo=github)](https://github.com/harvard-edge/cs249r_book/discussions/1076)
[![Docs](https://img.shields.io/badge/docs-mlsysbook.ai-blue?logo=readthedocs)](https://mlsysbook.ai/tinytorch)
[![Python](https://img.shields.io/badge/python-3.8+-3776ab?logo=python&logoColor=white)](https://python.org)