refactor: get hrp version from aliyun OSS file

This commit is contained in:
debugtalk
2022-04-25 16:23:38 +08:00
parent 7fcba33b97
commit c438c955fb
10 changed files with 26 additions and 18 deletions

View File

@@ -42,7 +42,8 @@ jobs:
access-key-secret: ${{ secrets.ALIYUN_ACCESSKEY_SECRET }}
- name: Upload artifacts to aliyun OSS
run: |
ossutil cp -rf hrp/internal/version/VERSION oss://httprunner/
ossutil cp -rf scripts/install.sh oss://httprunner/
ossutil cp -rf ${{ env.ASSET_PATH }} oss://httprunner/
- name: Test install.sh
run: bash -c "$(curl -ksSL https://httprunner.oss-cn-beijing.aliyuncs.com/install.sh)"
run: bash -c "$(curl -ksSL https://httprunner.com/script/install.sh)"

View File

@@ -60,8 +60,6 @@ You can install HttpRunner via one curl command.
```bash
$ bash -c "$(curl -ksSL https://httprunner.com/script/install.sh)"
# backup
$ bash -c "$(curl -ksSL https://httprunner.oss-cn-beijing.aliyuncs.com/install.sh)"
```
Then you will get a `hrp` CLI tool.

View File

@@ -53,8 +53,6 @@ HttpRunner 二进制命令行工具已上传至阿里云 OSS在系统终端
```bash
$ bash -c "$(curl -ksSL https://httprunner.com/script/install.sh)"
# backup
$ bash -c "$(curl -ksSL https://httprunner.oss-cn-beijing.aliyuncs.com/install.sh)"
```
安装成功后,你将获得一个 `hrp` 命令行工具,执行 `hrp -h` 即可查看到参数帮助说明。

View File

@@ -6,6 +6,7 @@
- feat: add builtin function `environ`/`ENV`
- fix: demo function compatibility
- change: get hrp version from aliyun OSS file when installing
## v4.0.0-beta (2022-04-24)

View File

@@ -0,0 +1 @@
v4.0.0-beta

View File

@@ -1,3 +1,8 @@
package version
const VERSION = "v4.0.0-beta"
import (
_ "embed"
)
//go:embed VERSION
var VERSION string

View File

@@ -1,4 +1,4 @@
__version__ = "4.0.0-beta"
__version__ = "v4.0.0-beta"
__description__ = "One-stop solution for HTTP(S) testing."
from httprunner.config import Config

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "httprunner"
version = "4.0.0-beta"
version = "v4.0.0-beta"
description = "One-stop solution for HTTP(S) testing."
license = "Apache-2.0"
readme = "README.md"

View File

@@ -16,11 +16,12 @@ if [ -z "$version" ]; then
exit 1
fi
echo "bump hrp version to $version"
sed -i'.bak' "s/\".*\"/\"v$version\"/g" hrp/internal/version/init.go
if [[ $version != v* ]]; then
version="v$version"
fi
echo "bump install.sh version to $version"
sed -i'.bak' "s/LATEST_VERSION=\".*\"/LATEST_VERSION=\"v$version\"/g" scripts/install.sh
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

View File

@@ -1,8 +1,6 @@
#!/bin/bash
# install hrp with one shell command
# bash -c "$(curl -ksSL https://httprunner.oss-cn-beijing.aliyuncs.com/install.sh)"
LATEST_VERSION="v4.0.0-beta"
# bash -c "$(curl -ksSL https://httprunner.com/script/install.sh)"
set -e
@@ -22,8 +20,7 @@ function echoWarn() {
export -f echoError
function get_latest_version() {
# <title>Release v0.4.0 · httprunner/hrp · GitHub</title>
curl -sL https://github.com/httprunner/httprunner/releases/latest | grep '<title>Release' | cut -d" " -f4
curl -ksSL https://httprunner.oss-cn-beijing.aliyuncs.com/VERSION
}
function get_os() {
@@ -61,7 +58,13 @@ function extract_pkg() {
function main() {
echoInfo "Detect target hrp package..."
version=$LATEST_VERSION
version=$(get_latest_version)
if [[ $version != v* ]]; then
echo "get hrp latest version failed:"
echo "$version"
exit 1
fi
os=$(get_os)
echo "Current OS: $os"
arch=$(get_arch)