Skip to content

Commit c584609

Browse files
maxgallianigamova
authored andcommitted
Update guidelines for version check and add script for version check
1 parent 7ee8f97 commit c584609

File tree

2 files changed

+174
-0
lines changed

2 files changed

+174
-0
lines changed

contributing.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,59 @@ As well as the [issues](https://github.com/cms-analysis/HiggsAnalysis-CombinedLi
144144
If you're interested in getting involved in any of these projects please contact us at [[email protected]](mailto:[email protected]).
145145

146146

147+
## Creating a New Release
148+
149+
When creating a new release, follow this checklist to ensure version strings are updated consistently across the codebase.
150+
151+
### Release Checklist
152+
153+
1. **Update version in source code**
154+
- Edit `bin/combine.cpp` line 36
155+
- Change `std::string combineTagString = "vX.Y.Z";` to the new version
156+
157+
2. **Update version in documentation**
158+
- Edit `docs/index.md`
159+
- Update line 40: `Currently, the recommended tag is **vX.Y.Z**`
160+
- Update line 47: `--branch vX.Y.Z` in the git clone command
161+
- Update the release notes link on line 40
162+
163+
3. **Verify version consistency**
164+
- Run the version check script: `./scripts/check-version.sh vX.Y.Z`
165+
- This will verify all version strings match
166+
167+
4. **Commit the version updates**
168+
- `git add bin/combine.cpp docs/index.md`
169+
- `git commit -m "Update version to vX.Y.Z"`
170+
171+
5. **Create and push the tag**
172+
- `git tag -a vX.Y.Z -m "Release vX.Y.Z"`
173+
- `git push origin main`
174+
- `git push origin vX.Y.Z`
175+
176+
6. **Create GitHub release**
177+
- Go to [Releases](https://github.com/cms-analysis/HiggsAnalysis-CombinedLimit/releases)
178+
- Click "Draft a new release"
179+
- Select the tag you just created
180+
- Add release notes
181+
182+
7. **Verify documentation deployment**
183+
- Check that the [documentation](http://cms-analysis.github.io/HiggsAnalysis-CombinedLimit/) shows the new version
184+
- The CI will automatically build and deploy docs for the new tag
185+
186+
### Version Check Script
187+
188+
A helper script is provided at `scripts/check-version.sh` that verifies version consistency.
189+
190+
Usage:
191+
```bash
192+
./scripts/check-version.sh v10.3.2
193+
```
194+
195+
This script checks that:
196+
- `bin/combine.cpp` contains the correct version
197+
- `docs/index.md` contains the correct version in all relevant locations
198+
- All version strings are consistent
199+
200+
The script will exit with an error if any inconsistencies are found.
201+
202+

scripts/check-version.sh

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
#!/bin/bash
2+
# Version consistency checker for Combine releases
3+
# This script verifies that version strings are consistent across the codebase
4+
5+
set -e
6+
7+
# Color codes for output
8+
RED='\033[0;31m'
9+
GREEN='\033[0;32m'
10+
YELLOW='\033[1;33m'
11+
NC='\033[0m' # No Color
12+
13+
# Check if version argument is provided
14+
if [ $# -eq 0 ]; then
15+
echo -e "${RED}Error: No version specified${NC}"
16+
echo "Usage: $0 vX.Y.Z"
17+
echo "Example: $0 v10.3.2"
18+
exit 1
19+
fi
20+
21+
VERSION=$1
22+
23+
# Validate version format
24+
if ! [[ $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
25+
echo -e "${RED}Error: Invalid version format${NC}"
26+
echo "Version must be in format vX.Y.Z (e.g., v10.3.2)"
27+
exit 1
28+
fi
29+
30+
echo "Checking version consistency for ${VERSION}..."
31+
echo ""
32+
33+
ERRORS=0
34+
35+
# Get script directory and repo root
36+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
37+
REPO_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )"
38+
39+
# Check 1: bin/combine.cpp
40+
echo -n "Checking bin/combine.cpp... "
41+
COMBINE_CPP="$REPO_ROOT/bin/combine.cpp"
42+
if [ ! -f "$COMBINE_CPP" ]; then
43+
echo -e "${RED}FAIL${NC}"
44+
echo " File not found: $COMBINE_CPP"
45+
ERRORS=$((ERRORS + 1))
46+
else
47+
if grep -q "std::string combineTagString = \"${VERSION}\"" "$COMBINE_CPP"; then
48+
echo -e "${GREEN}OK${NC}"
49+
else
50+
echo -e "${RED}FAIL${NC}"
51+
CURRENT=$(grep "std::string combineTagString" "$COMBINE_CPP" | sed -E 's/.*"(.*)".*/\1/')
52+
echo " Expected: std::string combineTagString = \"${VERSION}\""
53+
echo " Found: std::string combineTagString = \"${CURRENT}\""
54+
ERRORS=$((ERRORS + 1))
55+
fi
56+
fi
57+
58+
# Check 2: docs/index.md - recommended tag line
59+
echo -n "Checking docs/index.md (recommended tag)... "
60+
DOCS_INDEX="$REPO_ROOT/docs/index.md"
61+
if [ ! -f "$DOCS_INDEX" ]; then
62+
echo -e "${RED}FAIL${NC}"
63+
echo " File not found: $DOCS_INDEX"
64+
ERRORS=$((ERRORS + 1))
65+
else
66+
# Check for the main v10 recommended tag
67+
if grep -q "Currently, the recommended tag is \*\*${VERSION}\*\*" "$DOCS_INDEX"; then
68+
echo -e "${GREEN}OK${NC}"
69+
else
70+
echo -e "${RED}FAIL${NC}"
71+
CURRENT=$(grep "Currently, the recommended tag is" "$DOCS_INDEX" | head -1 | sed -E 's/.*\*\*([v0-9.]+)\*\*.*/\1/')
72+
echo " Expected: Currently, the recommended tag is **${VERSION}**"
73+
echo " Found: Currently, the recommended tag is **${CURRENT}**"
74+
ERRORS=$((ERRORS + 1))
75+
fi
76+
fi
77+
78+
# Check 3: docs/index.md - git clone branch
79+
echo -n "Checking docs/index.md (git clone branch)... "
80+
if grep -q "\-\-branch ${VERSION}" "$DOCS_INDEX"; then
81+
echo -e "${GREEN}OK${NC}"
82+
else
83+
echo -e "${RED}FAIL${NC}"
84+
CURRENT=$(grep "\-\-branch v" "$DOCS_INDEX" | head -1 | sed -E 's/.*--branch ([v0-9.]+).*/\1/')
85+
echo " Expected: --branch ${VERSION}"
86+
echo " Found: --branch ${CURRENT}"
87+
ERRORS=$((ERRORS + 1))
88+
fi
89+
90+
# Check 4: docs/index.md - release notes link
91+
echo -n "Checking docs/index.md (release notes link)... "
92+
if grep -q "releases/tag/${VERSION}" "$DOCS_INDEX"; then
93+
echo -e "${GREEN}OK${NC}"
94+
else
95+
echo -e "${YELLOW}WARNING${NC}"
96+
echo " Release notes link not found: releases/tag/${VERSION}"
97+
echo " This is expected if the release hasn't been created yet"
98+
fi
99+
100+
echo ""
101+
if [ $ERRORS -eq 0 ]; then
102+
echo -e "${GREEN}✓ All version checks passed!${NC}"
103+
echo ""
104+
echo "Next steps:"
105+
echo " 1. Commit the version updates:"
106+
echo " git add bin/combine.cpp docs/index.md"
107+
echo " git commit -m \"Update version to ${VERSION}\""
108+
echo " 2. Create and push the tag:"
109+
echo " git tag -a ${VERSION} -m \"Release ${VERSION}\""
110+
echo " git push origin main"
111+
echo " git push origin ${VERSION}"
112+
exit 0
113+
else
114+
echo -e "${RED}✗ Found ${ERRORS} error(s)${NC}"
115+
echo ""
116+
echo "Please fix the version inconsistencies and run this script again."
117+
exit 1
118+
fi

0 commit comments

Comments
 (0)