From f84aa615b0b4e072d2223b191a114f6bf782f79c Mon Sep 17 00:00:00 2001 From: "lilong.129" Date: Thu, 19 Sep 2024 16:38:40 +0800 Subject: [PATCH] feat: update hrp version with git commit hook --- hrp/internal/version/VERSION | 2 +- scripts/bump_version.sh | 30 ------------------------------ scripts/install-pre-commit-hook | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 31 deletions(-) delete mode 100644 scripts/bump_version.sh diff --git a/hrp/internal/version/VERSION b/hrp/internal/version/VERSION index 7378a3bb..7d4c6063 100644 --- a/hrp/internal/version/VERSION +++ b/hrp/internal/version/VERSION @@ -1 +1 @@ -v4.6.5 +v5.0.0-beta-2409191642 \ No newline at end of file diff --git a/scripts/bump_version.sh b/scripts/bump_version.sh deleted file mode 100644 index 98141421..00000000 --- a/scripts/bump_version.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# build hrp cli binary for testing -# release will be triggered on github actions, see .github/workflows/release.yml - -# Usage: -# $ make bump version=v4.3.0 -# or -# $ bash scripts/bump_version.sh v4.3.0 - -set -e - -version=$1 - -if [ -z "$version" ]; then - echo "version is required" - exit 1 -fi - -if [[ $version != v* ]]; then - version="v$version" -fi - -echo "bump hrp version to $version" -echo -n "$version" > hrp/internal/version/VERSION - -echo "bump httprunner version to $version" -sed -i'.bak' "s/__version__ = \".*\"/__version__ = \"$version\"/g" httprunner/__init__.py - -echo "bump pyproject.toml version to $version" -sed -i'.bak' "s/^version = \".*\"/version = \"$version\"/g" pyproject.toml diff --git a/scripts/install-pre-commit-hook b/scripts/install-pre-commit-hook index 6c47fa98..350275bd 100644 --- a/scripts/install-pre-commit-hook +++ b/scripts/install-pre-commit-hook @@ -18,6 +18,7 @@ function install() { # 1. gofumpt go files automatically # 2. goimports-reviser go files automatically # 3. black python files automatically +# 4. bump hrp version # make sure gofumpt is installed # What does each letter mean in "ACMRTUXB"? @@ -38,6 +39,22 @@ do black "$file" git add "$file" done + +# bump hrp version +version_file=hrp/internal/version/VERSION + +# get current date +current_date=$(date +"%y%m%d%H%M") + +# update version +sed -i '' "s/[0-9]\{10\}/${current_date}/" "$version_file" + +# add change to stage +git add $version_file + +# print updated version +updated_version=$(cat "$version_file") +echo "update hrp version to $updated_version" EOF chmod +x $PRE_COMMIT_FILE