Skip to content

❌ SUPERSEDED - Extract version bump logic into reusable script #138

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# GitHub Scripts

This directory contains reusable scripts for GitHub Actions workflows.

## version-bump.sh

Extracts version bump logic from GitHub Actions workflows into a reusable script.

### Usage

```bash
./version-bump.sh <bump_type> [base_ref]
```

**Parameters:**
- `bump_type`: Type of version bump (`patch`, `minor`, or `major`)
- `base_ref`: Base reference for diff comparison (default: `origin/main`)

### Examples

```bash
# Bump patch version for modules changed since origin/main
./version-bump.sh patch

# Bump minor version for modules changed since a specific commit
./version-bump.sh minor abc123

# Bump major version for modules changed since a specific branch
./version-bump.sh major origin/develop
```

### What it does

1. **Detects modified modules** from git diff changes
2. **Gets current version** from latest release tag or README
3. **Calculates new version** based on bump type
4. **Updates README versions** in module documentation
5. **Provides summary** of changes and next steps

### Version Detection

- **Tagged modules**: Uses latest `release/namespace/module/vX.Y.Z` tag
- **Untagged modules**: Extracts version from README `version = "X.Y.Z"`
- **New modules**: Start from v1.0.0

### Exit Codes

- `0`: Success (with or without changes)
- `1`: Error (invalid arguments, no modules found, invalid version format, etc.)

### Integration with GitHub Actions

This script is designed to be called from GitHub Actions workflows. See `.github/workflows/version-bump.yaml` for an example implementation that:

- Triggers on PR labels (`version:patch`, `version:minor`, `version:major`)
- Runs the script with appropriate parameters
- Commits any README changes
- Comments on the PR with results

### Notes

- Only updates READMEs that contain version references matching the module source
- Warns about modules missing proper git tags
- Follows semantic versioning (X.Y.Z format)
- Validates all version components are numeric
Loading