1
0
Fork 0

Add --current flag to bump-version.sh for displaying current versions

- Introduced `--current` flag to show the current App and Chart versions.
- Improved user guidance with updated usage instructions and scripts output.
- Added post-merge steps to the version bump process.
This commit is contained in:
Joao Gilberto Magalhaes 2026-02-07 21:37:51 -05:00
parent 8d24cdb513
commit a07c3fc9e3
2 changed files with 47 additions and 5 deletions

View file

@ -329,6 +329,7 @@ helm show chart byjg/easyhaproxy
| Version | Release Date | Type | Highlights | | Version | Release Date | Type | Highlights |
|---------|--------------|-------|---------------------------------------------------------------------------------------------------------------------------------------| |---------|--------------|-------|---------------------------------------------------------------------------------------------------------------------------------------|
| 5.1.0 | 2026-02-XX | Minor | IngressClassName support for Kubernetes, modernized build system (uv/pyproject.toml), improved version management and release tooling |
| 5.0.0 | 2025-12-04 | Major | Plugin framework (builtin plugins: JWT, FastCGI, Cloudflare, IP whitelist, deny pages, cleanup), docs restructure, examples refreshed | | 5.0.0 | 2025-12-04 | Major | Plugin framework (builtin plugins: JWT, FastCGI, Cloudflare, IP whitelist, deny pages, cleanup), docs restructure, examples refreshed |
| 4.6.0 | 2024-11-27 | Minor | FastCGI plugin, JWT enhancements | | 4.6.0 | 2024-11-27 | Minor | FastCGI plugin, JWT enhancements |
| 4.5.0 | 2024-XX-XX | Minor | Previous release | | 4.5.0 | 2024-XX-XX | Minor | Previous release |

View file

@ -6,14 +6,35 @@ usage() {
Usage: Usage:
scripts/bump-version.sh <new-version> scripts/bump-version.sh <new-version>
scripts/bump-version.sh --verify <new-version> scripts/bump-version.sh --verify <new-version>
scripts/bump-version.sh --current
Description: Description:
Updates all version references (images, docs, Helm chart) to <new-version> Updates all version references (images, docs, Helm chart) to <new-version>
and bumps the Helm chart version patch. Use --verify to check the repo is and bumps the Helm chart version patch. Use --verify to check the repo is
already updated for <new-version> (no changes are made). already updated for <new-version> (no changes are made). Use --current to
display the current versions.
EOF EOF
} }
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
CHART_FILE="$REPO_ROOT/helm/easyhaproxy/Chart.yaml"
# Handle --current flag
if [[ "${1:-}" == "--current" ]]; then
if [[ ! -f "$CHART_FILE" ]]; then
echo "Error: Chart file not found at $CHART_FILE"
exit 1
fi
CURRENT_APP_VERSION=$(grep 'appVersion:' "$CHART_FILE" | head -1 | awk -F'"' '{print $2}')
CURRENT_CHART_VERSION=$(grep '^version:' "$CHART_FILE" | head -1 | awk '{print $2}')
CURRENT_PYPROJECT_VERSION=$(grep '^version = ' "$REPO_ROOT/pyproject.toml" | head -1 | awk -F'"' '{print $2}')
echo "Current versions:"
echo " App Version: $CURRENT_APP_VERSION"
echo " Chart Version: $CURRENT_CHART_VERSION"
echo " pyproject.toml: $CURRENT_PYPROJECT_VERSION"
exit 0
fi
MODE="apply" MODE="apply"
if [[ "${1:-}" == "--verify" ]]; then if [[ "${1:-}" == "--verify" ]]; then
MODE="verify" MODE="verify"
@ -31,10 +52,23 @@ if [[ "$NEW_VERSION" == "latest" ]]; then
exit 0 exit 0
fi fi
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # Extract base version (strip pre-release suffix for RELEASE.md check)
cd "$REPO_ROOT" # Examples: 5.1.0-beta.1 -> 5.1.0, 5.1.0b1 -> 5.1.0, 5.1.0 -> 5.1.0
BASE_VERSION=$(echo "$NEW_VERSION" | sed -E 's/^([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
CHART_FILE="helm/easyhaproxy/Chart.yaml" # Check if base version exists in RELEASE.md Version History
if ! grep -q "| $BASE_VERSION " "$REPO_ROOT/RELEASE.md"; then
echo "❌ Error: Version $BASE_VERSION not found in RELEASE.md Version History table."
echo ""
echo "Please manually add an entry for version $BASE_VERSION to RELEASE.md before running this script."
echo "Add a row to the Version History table like:"
echo ""
echo "| $BASE_VERSION | YYYY-MM-DD | Major/Minor/Patch | Brief description of changes |"
echo ""
exit 1
fi
cd "$REPO_ROOT"
CURRENT_APP_VERSION=$(grep 'appVersion:' "$CHART_FILE" | head -1 | awk -F'"' '{print $2}') CURRENT_APP_VERSION=$(grep 'appVersion:' "$CHART_FILE" | head -1 | awk -F'"' '{print $2}')
CURRENT_CHART_VERSION_RAW=$(grep '^version:' "$CHART_FILE" | head -1 | awk '{print $2}') CURRENT_CHART_VERSION_RAW=$(grep '^version:' "$CHART_FILE" | head -1 | awk '{print $2}')
# Normalize chart version (strip trailing dots/spaces) # Normalize chart version (strip trailing dots/spaces)
@ -58,6 +92,7 @@ if [[ "$MODE" == "verify" ]]; then
check_contains "version: \"$NEW_VERSION\"" deploy/kubernetes/easyhaproxy-daemonset.yml "K8s daemonset manifest version" check_contains "version: \"$NEW_VERSION\"" deploy/kubernetes/easyhaproxy-daemonset.yml "K8s daemonset manifest version"
check_contains "easy-haproxy:$NEW_VERSION" deploy/kubernetes/easyhaproxy-daemonset.yml "K8s daemonset image tag" check_contains "easy-haproxy:$NEW_VERSION" deploy/kubernetes/easyhaproxy-daemonset.yml "K8s daemonset image tag"
check_contains "easy-haproxy:$NEW_VERSION" deploy/docker/docker-compose.yml "Docker compose image tag" check_contains "easy-haproxy:$NEW_VERSION" deploy/docker/docker-compose.yml "Docker compose image tag"
check_contains "version = \"$NEW_VERSION\"" pyproject.toml "pyproject.toml version"
if grep -R "byjg/easy-haproxy:" examples | grep -v "$NEW_VERSION" >/dev/null; then if grep -R "byjg/easy-haproxy:" examples | grep -v "$NEW_VERSION" >/dev/null; then
echo "❌ Examples still reference a different tag. Run bump-version.sh to update." echo "❌ Examples still reference a different tag. Run bump-version.sh to update."
@ -80,13 +115,16 @@ sed -i "s#easy-haproxy:[a-zA-Z0-9\\.-]*#easy-haproxy:$NEW_VERSION#g" docs/swarm.
sed -i "s/^\\*\\*Current Version:\\*\\* \`[^\`]*\`/**Current Version:** \`$NEW_VERSION\`/" RELEASE.md sed -i "s/^\\*\\*Current Version:\\*\\* \`[^\`]*\`/**Current Version:** \`$NEW_VERSION\`/" RELEASE.md
sed -i "s/^\\*\\*App Version:\\*\\* \`[^\`]*\`/**App Version:** \`$NEW_VERSION\`/" RELEASE.md sed -i "s/^\\*\\*App Version:\\*\\* \`[^\`]*\`/**App Version:** \`$NEW_VERSION\`/" RELEASE.md
# Update pyproject.toml
sed -i "s#^version = \"[a-zA-Z0-9\\.-]*\"#version = \"$NEW_VERSION\"#g" pyproject.toml
# Update Helm appVersion # Update Helm appVersion
sed -i "s#appVersion: \"[a-zA-Z0-9\\.-]*\"#appVersion: \"$NEW_VERSION\"#g" "$CHART_FILE" sed -i "s#appVersion: \"[a-zA-Z0-9\\.-]*\"#appVersion: \"$NEW_VERSION\"#g" "$CHART_FILE"
# Update examples # Update examples
find examples -type f -name '*.yml' -exec sed -i "s#\\(byjg/easy-haproxy:\\)[a-zA-Z0-9\\.-]*#\\1$NEW_VERSION#g" {} \; -print find examples -type f -name '*.yml' -exec sed -i "s#\\(byjg/easy-haproxy:\\)[a-zA-Z0-9\\.-]*#\\1$NEW_VERSION#g" {} \; -print
# Update raw GitHub URLs in Kubernetes examples # Update raw GitHub URLs in Kubernetes examples
find examples/kubernetes -type f -name '*.yml' -exec sed -i "s#raw.githubusercontent.com/byjg/docker-easy-haproxy/[0-9\\.\\-]*/deploy/kubernetes/easyhaproxy-daemonset.yml#raw.githubusercontent.com/byjg/docker-easy-haproxy/$NEW_VERSION/deploy/kubernetes/easyhaproxy-daemonset.yml#g" {} \; find examples/kubernetes -type f -name '*.yml' -exec sed -i "s#raw.githubusercontent.com/byjg/docker-easy-haproxy/[a-zA-Z0-9\\.\\-]*/deploy/kubernetes/easyhaproxy-daemonset.yml#raw.githubusercontent.com/byjg/docker-easy-haproxy/$NEW_VERSION/deploy/kubernetes/easyhaproxy-daemonset.yml#g" {} \;
# Bump chart version (patch) # Bump chart version (patch)
SANITIZED_CHART_VERSION="${CURRENT_CHART_VERSION%\.}" SANITIZED_CHART_VERSION="${CURRENT_CHART_VERSION%\.}"
@ -107,3 +145,6 @@ echo " 1) git status (review changes)"
echo " 2) git add ." echo " 2) git add ."
echo " 3) git commit -m \"Bump version to $NEW_VERSION (chart $NEXT_CHART_VERSION)\"" echo " 3) git commit -m \"Bump version to $NEW_VERSION (chart $NEXT_CHART_VERSION)\""
echo " 4) Open a PR to master and merge via PR." echo " 4) Open a PR to master and merge via PR."
echo " 5) After merge: git checkout master && git pull"
echo " 6) git tag -a $NEW_VERSION -m \"Release $NEW_VERSION\""
echo " 7) git push origin $NEW_VERSION"