Skip to content

Commit aad8df0

Browse files
Copilotchrisburr
andcommitted
Add CI workflow to check version bumps in PRs
Co-authored-by: chrisburr <[email protected]>
1 parent 4213e37 commit aad8df0

File tree

2 files changed

+134
-0
lines changed

2 files changed

+134
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Version Bump Check
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
check-version-bump:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout PR branch
13+
uses: actions/checkout@v5
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Check for version bumps
18+
run: |
19+
set -e
20+
21+
# Get the base branch
22+
BASE_BRANCH="${{ github.base_ref }}"
23+
echo "Base branch: $BASE_BRANCH"
24+
25+
# Fetch the base branch
26+
git fetch origin "$BASE_BRANCH"
27+
28+
# Find all Chart.yaml files (including subcharts)
29+
CHART_FILES=$(find . -name "Chart.yaml" -type f | grep -v "/\.")
30+
31+
echo "Checking Chart.yaml files for version bumps..."
32+
33+
FAILED=0
34+
35+
for CHART_FILE in $CHART_FILES; do
36+
echo "---"
37+
echo "Checking: $CHART_FILE"
38+
39+
# Get current version
40+
CURRENT_VERSION=$(grep "^version:" "$CHART_FILE" | awk '{print $2}' | tr -d '"' | tr -d "'")
41+
echo "Current version: $CURRENT_VERSION"
42+
43+
# Get base version (check if file exists in base branch)
44+
if git cat-file -e "origin/$BASE_BRANCH:$CHART_FILE" 2>/dev/null; then
45+
BASE_VERSION=$(git show "origin/$BASE_BRANCH:$CHART_FILE" | grep "^version:" | awk '{print $2}' | tr -d '"' | tr -d "'")
46+
echo "Base version: $BASE_VERSION"
47+
48+
# Compare versions
49+
if [ "$CURRENT_VERSION" == "$BASE_VERSION" ]; then
50+
echo "❌ ERROR: Version in $CHART_FILE has not been bumped!"
51+
echo " Current: $CURRENT_VERSION"
52+
echo " Base: $BASE_VERSION"
53+
echo " Please increment the version in $CHART_FILE"
54+
FAILED=1
55+
else
56+
echo "✅ Version bumped from $BASE_VERSION to $CURRENT_VERSION"
57+
fi
58+
else
59+
echo "ℹ️ New chart file (not in base branch), skipping version check"
60+
fi
61+
done
62+
63+
echo "---"
64+
65+
if [ $FAILED -eq 1 ]; then
66+
echo ""
67+
echo "❌ Version bump check FAILED"
68+
echo "One or more Chart.yaml files need version updates."
69+
echo "Please increment the version field according to semantic versioning."
70+
exit 1
71+
else
72+
echo "✅ All Chart.yaml files have been properly versioned"
73+
fi

CONTRIBUTING.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Contributing to diracx-charts
2+
3+
Thank you for your interest in contributing to diracx-charts!
4+
5+
## Pull Request Requirements
6+
7+
When submitting a pull request, please ensure the following:
8+
9+
### Version Bumping
10+
11+
**All pull requests MUST bump the chart version(s) being modified.**
12+
13+
The repository uses automated CI checks to ensure that chart versions are incremented in every PR. This is required because:
14+
15+
- The repository follows a "live at head" approach
16+
- Charts are automatically pushed to by diracx and diracx-web repositories
17+
- The main branch is always tagged with the current version
18+
19+
#### Which versions need to be bumped?
20+
21+
If your changes affect:
22+
23+
- **The main chart** (`diracx/Chart.yaml`): Increment the `version` field following [Semantic Versioning](https://semver.org/)
24+
- MAJOR version for incompatible API changes
25+
- MINOR version for backwards-compatible functionality additions
26+
- PATCH version for backwards-compatible bug fixes
27+
28+
- **The cert-manager-issuer subchart** (`diracx/charts/cert-manager-issuer/Chart.yaml`): Increment the `version` field if you modify this subchart
29+
30+
#### Example
31+
32+
If the current version in `diracx/Chart.yaml` is `1.0.0` and you're making a backward-compatible bug fix:
33+
34+
```yaml
35+
# Before
36+
version: "1.0.0"
37+
38+
# After
39+
version: "1.0.1"
40+
```
41+
42+
### Pre-commit Checks
43+
44+
This repository uses pre-commit hooks. Make sure to install them:
45+
46+
```bash
47+
pip install pre-commit
48+
pre-commit install
49+
```
50+
51+
### Testing
52+
53+
Before submitting your PR, ensure that:
54+
55+
1. Pre-commit checks pass: `pre-commit run --all-files`
56+
2. The demo runs successfully: `./run_demo.sh --exit-when-done`
57+
3. Helm linting passes: `helm lint diracx/ --set diracx.hostname=diracx.invalid`
58+
59+
## Questions?
60+
61+
If you have questions about contributing, please open an issue for discussion.

0 commit comments

Comments
 (0)