✨ feat: automated version badge updates and CI/CD improvements
Some checks failed
CI/CD Pipeline / CI Pipeline (push) Failing after 16m21s
Some checks failed
CI/CD Pipeline / CI Pipeline (push) Failing after 16m21s
This commit is contained in:
@@ -19,6 +19,10 @@ on:
|
|||||||
- 'doc/**'
|
- 'doc/**'
|
||||||
- 'adr/**'
|
- 'adr/**'
|
||||||
- '.gitea/**'
|
- '.gitea/**'
|
||||||
|
- 'documentation/**'
|
||||||
|
- '*.md'
|
||||||
|
- '.vibe/**'
|
||||||
|
- 'features/**'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
@@ -28,6 +32,10 @@ on:
|
|||||||
- 'doc/**'
|
- 'doc/**'
|
||||||
- 'adr/**'
|
- 'adr/**'
|
||||||
- '.gitea/**'
|
- '.gitea/**'
|
||||||
|
- 'documentation/**'
|
||||||
|
- '*.md'
|
||||||
|
- '.vibe/**'
|
||||||
|
- 'features/**'
|
||||||
|
|
||||||
# cancel any previously-started runs of this workflow on the same branch
|
# cancel any previously-started runs of this workflow on the same branch
|
||||||
concurrency:
|
concurrency:
|
||||||
@@ -125,7 +133,7 @@ jobs:
|
|||||||
if [ "$VERSION_BUMPED" = "true" ]; then
|
if [ "$VERSION_BUMPED" = "true" ]; then
|
||||||
git config --global user.name "CI Bot"
|
git config --global user.name "CI Bot"
|
||||||
git config --global user.email "ci@arcodange.fr"
|
git config --global user.email "ci@arcodange.fr"
|
||||||
git add VERSION cmd/server/main.go
|
git add VERSION cmd/server/main.go README.md
|
||||||
git commit -m "chore: auto version bump [skip ci]" || echo "No changes to commit"
|
git commit -m "chore: auto version bump [skip ci]" || echo "No changes to commit"
|
||||||
git push
|
git push
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# DanceLessonsCoach
|
# DanceLessonsCoach
|
||||||
|
|
||||||
[](https://gitea.arcodange.fr/arcodange/dance-lessons-coach)
|
[](https://gitea.arcodange.fr/arcodange/DanceLessonsCoach)
|
||||||
[](https://goreportcard.com/report/github.com/arcodange/dance-lessons-coach)
|
[](https://goreportcard.com/report/github.com/arcodange/DanceLessonsCoach)
|
||||||
[](https://gitea.arcodange.fr/arcodange/dance-lessons-coach/releases)
|
[](https://gitea.arcodange.fr/arcodange/DanceLessonsCoach/releases)
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
|
|
||||||
A Go project demonstrating idiomatic package structure, CLI implementation, and JSON API with Chi router.
|
A Go project demonstrating idiomatic package structure, CLI implementation, and JSON API with Chi router.
|
||||||
|
|||||||
@@ -708,6 +708,43 @@ docker compose -f docker-compose.cicd-test.yml up
|
|||||||
7. **Multi-Arch Builds**: Support ARM64, Windows builds
|
7. **Multi-Arch Builds**: Support ARM64, Windows builds
|
||||||
8. **Matrix Testing**: Test across multiple Go versions
|
8. **Matrix Testing**: Test across multiple Go versions
|
||||||
|
|
||||||
|
## Automated Version Badge Workflow
|
||||||
|
|
||||||
|
The CI/CD pipeline includes an automated workflow for maintaining version badges in README.md:
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph TD
|
||||||
|
A[Developer Pushes Commit] --> B{Commit Type?}
|
||||||
|
B -->|feat:| C[Bump MINOR version]
|
||||||
|
B -->|fix:| D[Bump PATCH version]
|
||||||
|
B -->|breaking:| E[Bump MAJOR version]
|
||||||
|
B -->|other| F[No version bump]
|
||||||
|
C --> G[Update VERSION file]
|
||||||
|
D --> G[Update VERSION file]
|
||||||
|
E --> G[Update VERSION file]
|
||||||
|
G --> H[Update main.go Swagger version]
|
||||||
|
H --> I[Update README.md version badge]
|
||||||
|
I --> J[Commit & Push changes]
|
||||||
|
J --> K[Skip CI to prevent loops]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Workflow Details
|
||||||
|
|
||||||
|
1. **Trigger**: Push events to main branch with specific commit message patterns
|
||||||
|
2. **Version Detection**: Parses commit messages for conventional commit types
|
||||||
|
3. **Automatic Bumping**: Increments version based on commit type (feat → minor, fix → patch, breaking → major)
|
||||||
|
4. **File Updates**: Updates VERSION file, Swagger documentation, and README.md badge
|
||||||
|
5. **Automatic Commit**: CI Bot commits changes with `[skip ci]` to prevent infinite loops
|
||||||
|
6. **Push**: Automatically pushes the version update back to the repository
|
||||||
|
|
||||||
|
### Benefits
|
||||||
|
|
||||||
|
- **Automatic Maintenance**: README.md version badge always stays current
|
||||||
|
- **No Manual Intervention**: Developers don't need to remember to update badges
|
||||||
|
- **Consistent Versioning**: Follows semantic versioning automatically
|
||||||
|
- **Audit Trail**: Version bumps are tracked in git history
|
||||||
|
- **CI/CD Integration**: Seamlessly integrated with existing pipeline
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [Gitea Actions Documentation](https://docs.gitea.com/next/usage/actions/)
|
- [Gitea Actions Documentation](https://docs.gitea.com/next/usage/actions/)
|
||||||
|
|||||||
@@ -130,4 +130,24 @@ if [ -f "$MAIN_GO" ]; then
|
|||||||
echo "✅ Updated Swagger version in main.go"
|
echo "✅ Updated Swagger version in main.go"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Update README.md version badge
|
||||||
|
README_MD="README.md"
|
||||||
|
if [ -f "$README_MD" ]; then
|
||||||
|
# Create temporary file
|
||||||
|
TMP_FILE=$(mktemp)
|
||||||
|
|
||||||
|
# Use awk to update version badge
|
||||||
|
awk -v new_version="$NEW_VERSION" '{
|
||||||
|
if ($0 ~ /Version.*badge.*version/) {
|
||||||
|
print "[](https://gitea.arcodange.fr/arcodange/DanceLessonsCoach/releases)"
|
||||||
|
} else {
|
||||||
|
print $0
|
||||||
|
}
|
||||||
|
}' "$README_MD" > "$TMP_FILE"
|
||||||
|
|
||||||
|
# Replace original file
|
||||||
|
mv "$TMP_FILE" "$README_MD"
|
||||||
|
echo "✅ Updated version badge in README.md"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "🎉 Version bump complete: $NEW_VERSION"
|
echo "🎉 Version bump complete: $NEW_VERSION"
|
||||||
|
|||||||
Reference in New Issue
Block a user