mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-26 01:51:29 +08:00
feat: update hrp version with git commit hook
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user