change: replace download url with aliyun oss

This commit is contained in:
debugtalk
2022-01-20 18:15:53 +08:00
parent a898adb651
commit db596b13ca
3 changed files with 25 additions and 5 deletions

View File

@@ -29,3 +29,10 @@ jobs:
binary_name: "hrp"
ldflags: "-s -w"
extra_files: LICENSE README.md docs/CHANGELOG.md
- name: Upload to aliyun OSS
uses: manyuanrong/setup-ossutil@v2.0
with:
endpoint: "oss-cn-beijing.aliyuncs.com"
access-key-id: ${{ secrets.ALIYUN_ACCESSKEY_ID }}
access-key-secret: ${{ secrets.ALIYUN_ACCESSKEY_SECRET }}
- run: ossutil cp -rf cli/scripts/install.sh *.tar.gz *.zip oss://httprunner/

View File

@@ -30,9 +30,9 @@ You can install `hrp` with one shell command, which will download the latest ver
```bash
# install via curl
$ bash -c "$(curl -ksSL https://raw.githubusercontent.com/httprunner/hrp/main/cli/scripts/install.sh)"
$ bash -c "$(curl -ksSL https://httprunner.oss-cn-beijing.aliyuncs.com/install.sh)"
# install via wget
$ bash -c "$(wget https://raw.githubusercontent.com/httprunner/hrp/main/cli/scripts/install.sh -O -)"
$ bash -c "$(wget https://httprunner.oss-cn-beijing.aliyuncs.com/install.sh -O -)"
```
If you are a golang developer, you can also install `hrp` with `go get`.

View File

@@ -1,6 +1,6 @@
#!/bin/bash
# install hrp with one shell command
# bash -c "$(curl -ksSL https://raw.githubusercontent.com/httprunner/hrp/main/cli/scripts/install.sh)"
# bash -c "$(curl -ksSL https://httprunner.oss-cn-beijing.aliyuncs.com/install.sh)"
set -e
@@ -24,6 +24,11 @@ function get_latest_version() {
curl -sL https://github.com/httprunner/hrp/releases/latest | grep '<title>Release' | cut -d" " -f4
}
function get_os() {
os=$(uname -s)
echo "$os" | tr '[:upper:]' '[:lower:]'
}
function get_arch() {
arch=$(uname -m)
if [ "$arch" == "x86_64" ]; then
@@ -32,16 +37,24 @@ function get_arch() {
echo "$arch"
}
function get_download_url() {
# github
# url="https://github.com/httprunner/hrp/releases/download/$version/$1"
# aliyun oss
url="https://httprunner.oss-cn-beijing.aliyuncs.com/$1"
echo $url
}
function main() {
echoInfo "Detect target hrp package..."
version=$(get_latest_version)
echo "Latest version: $version"
os=$(uname -s)
os=$(get_os)
echo "Current OS: $os"
arch=$(get_arch)
echo "Current ARCH: $arch"
pkg="hrp-$version-$os-$arch.tar.gz"
url="https://github.com/httprunner/hrp/releases/download/$version/$pkg"
url=$(get_download_url $pkg)
echo "Selected package: $url"
echo