diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index cc28458ec..000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ -# Build worker image (VM template) -build: off - -image: Visual Studio 2019 - -# clone directory -clone_folder: C:\Users\appveyor\go\src\github.com\aliyun\aliyun-cli - -stack: go 1.16 - -# scripts that run after cloning repository -install: - # by default, all script lines are interpreted as batch - - cmd: git submodule update --init --recursive - - cmd: set path=%path%;C:\Users\appveyor\go\bin - - cmd: set VERSION=3.0.0-beta - - cmd: go build -ldflags "-X 'github.com/aliyun/aliyun-cli/cli.Version=%VERSION%'" -o C:\Users\appveyor\go\bin\aliyun.exe main/main.go - -# build platform, i.e. x86, x64, Any CPU. This setting is optional. -platform: x64 - -test_script: -- ps: >- - go vet ./cli/... ./config/... ./i18n/... ./main/... ./openapi/... ./oss/... ./resource/... - - go test -covermode=atomic ./cli/... ./config/... ./i18n/... ./meta/... ./main/... ./openapi/... ./resource/... - - $client = new-object System.Net.WebClient - - $client.DownloadFile('https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win64.exe', 'C:/go/bin/jq.exe') - - if (-not $env:ACCESS_KEY_ID.length -eq 0 -and -not $env:ACCESS_KEY_SECRET.length -eq 0){./integration/ecs_test.PS1} diff --git a/install.sh b/install.sh index 1ff035664..6b0f1e558 100644 --- a/install.sh +++ b/install.sh @@ -46,7 +46,7 @@ then VERSION="$OPTARG" ;; *) - echo -e "${r}Unexpected flag not supported${x}" + echo -e "Unexpected flag not supported" exit 1 ;; esac @@ -69,8 +69,8 @@ echo -e " if [[ -n "${CLI_ON_MACOS-}" ]] then - curl -O -fsSL https://aliyuncli.alicdn.com/aliyun-cli-macosx-$VERSION-universal.tgz - tar zxf aliyun-cli-macosx-$VERSION-universal.tgz + curl -O -fsSL https://aliyuncli.alicdn.com/aliyun-cli-macosx-"$VERSION"-universal.tgz + tar zxf aliyun-cli-macosx-"$VERSION"-universal.tgz mv ./aliyun /usr/local/bin/ fi @@ -79,11 +79,11 @@ then UNAME_MACHINE="$(/usr/bin/uname -m)" if [[ "${UNAME_MACHINE}" == "arm64" ]] then - curl -O -fsSL https://aliyuncli.alicdn.com/aliyun-cli-linux-$VERSION-arm64.tgz - tar zxf aliyun-cli-linux-$VERSION-arm64.tgz + curl -O -fsSL https://aliyuncli.alicdn.com/aliyun-cli-linux-"$VERSION"-arm64.tgz + tar zxf aliyun-cli-linux-"$VERSION"-arm64.tgz else - curl -O -fsSL https://aliyuncli.alicdn.com/aliyun-cli-linux-$VERSION-amd64.tgz - tar zxf aliyun-cli-linux-$VERSION-amd64.tgz + curl -O -fsSL https://aliyuncli.alicdn.com/aliyun-cli-linux-"$VERSION"-amd64.tgz + tar zxf aliyun-cli-linux-"$VERSION"-amd64.tgz fi mv ./aliyun /usr/local/bin/ fi diff --git a/tools/build_pkg.sh b/tools/build_pkg.sh index 24d97a776..099d27f5e 100644 --- a/tools/build_pkg.sh +++ b/tools/build_pkg.sh @@ -7,21 +7,21 @@ mkdir -p out/productbuild cp out/aliyun out/dist/usr/local/bin/ mkdir -p out/pkgs -pkgbuild --version $VERSION \ +pkgbuild --version "$VERSION" \ --identifier com.aliyun.cli.pkg \ - --root out/dist out/pkgs/aliyun-cli-${VERSION}.pkg + --root out/dist out/pkgs/aliyun-cli-"${VERSION}".pkg cat pkg/productbuild/distribution.xml.tmpl | \ sed -E "s/\\{cli_version\\}/$VERSION/g" > out/productbuild/distribution.xml for dirname in pkg/productbuild/Resources/*/; do - lang=$(basename $dirname) - mkdir -p out/productbuild/Resources/$lang - printf "Found localization directory $dirname\n" - cat $dirname/welcome.html.tmpl | \ - sed -E "s/\\{cli_version\\}/$VERSION/g" > out/productbuild/Resources/$lang/welcome.html - cat $dirname/conclusion.html.tmpl | \ - sed -E "s/\\{cli_version\\}/$VERSION/g" > out/productbuild/Resources/$lang/conclusion.html + lang=$(basename "$dirname") + mkdir -p out/productbuild/Resources/"$lang" + printf "Found localization directory %s\n" "$dirname" + cat "$dirname"/welcome.html.tmpl | \ + sed -E "s/\\{cli_version\\}/$VERSION/g" > out/productbuild/Resources/"$lang"/welcome.html + cat "$dirname"/conclusion.html.tmpl | \ + sed -E "s/\\{cli_version\\}/$VERSION/g" > out/productbuild/Resources/"$lang"/conclusion.html done cp pkg/osx_installer_logo.png out/productbuild/Resources @@ -30,4 +30,4 @@ cp LICENSE out/productbuild/Resources/license.txt productbuild --distribution out/productbuild/distribution.xml \ --resources out/productbuild/Resources \ --package-path out/pkgs \ - out/aliyun-cli-${VERSION}.pkg + out/aliyun-cli-"${VERSION}".pkg diff --git a/tools/download_assets.sh b/tools/download_assets.sh index 7b2eaf7a5..87cc6e18c 100644 --- a/tools/download_assets.sh +++ b/tools/download_assets.sh @@ -2,12 +2,6 @@ VERSION=$1 -RELEASE_ID=$(curl -fsSL \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $GITHUB_TOKEN" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/aliyun/aliyun-cli/releases/tags/v$VERSION | jq '.["id"]') - LIST=( "aliyun-cli-macosx-$VERSION-amd64.tgz" "aliyun-cli-macosx-$VERSION-arm64.tgz" @@ -18,12 +12,12 @@ LIST=( "aliyun-cli-windows-$VERSION-amd64.zip" ) -for filename in ${LIST[@]} +for filename in "${LIST[@]}" do curl -fsSL -O \ -H "Authorization: Bearer $GITHUB_TOKEN" \ - https://github.com/aliyun/aliyun-cli/releases/download/v$VERSION/$filename - shasum -a 256 $filename >> SHASUMS256.txt + https://github.com/aliyun/aliyun-cli/releases/download/v"$VERSION"/"$filename" + shasum -a 256 "$filename" >> SHASUMS256.txt done cat ./SHASUMS256.txt diff --git a/tools/finish_release.sh b/tools/finish_release.sh index 9ec0f9ee1..309e68ffd 100644 --- a/tools/finish_release.sh +++ b/tools/finish_release.sh @@ -9,53 +9,53 @@ go build -ldflags "-X 'github.com/aliyun/aliyun-cli/cli.Version=${VERSION}'" -o FLAGS="oss://aliyun-cli --force --access-key-id ${ACCESS_KEY_ID} --access-key-secret ${ACCESS_KEY_SECRET} --region cn-hangzhou" # mac amd64 -${ALIYUN} oss cp ./aliyun-cli-macosx-${VERSION}-amd64.tgz $FLAGS +${ALIYUN} oss cp ./aliyun-cli-macosx-"${VERSION}"-amd64.tgz "$FLAGS" # mac arm64 -${ALIYUN} oss cp ./aliyun-cli-macosx-${VERSION}-arm64.tgz $FLAGS +${ALIYUN} oss cp ./aliyun-cli-macosx-"${VERSION}"-arm64.tgz "$FLAGS" # mac universal -${ALIYUN} oss cp ./aliyun-cli-macosx-${VERSION}-universal.tgz $FLAGS +${ALIYUN} oss cp ./aliyun-cli-macosx-"${VERSION}"-universal.tgz "$FLAGS" # mac pkg -${ALIYUN} oss cp ./aliyun-cli-${VERSION}.pkg $FLAGS +${ALIYUN} oss cp ./aliyun-cli-"${VERSION}".pkg "$FLAGS" # linux amd64 -${ALIYUN} oss cp ./aliyun-cli-linux-${VERSION}-amd64.tgz $FLAGS +${ALIYUN} oss cp ./aliyun-cli-linux-"${VERSION}"-amd64.tgz "$FLAGS" # linux arm64 -${ALIYUN} oss cp ./aliyun-cli-linux-${VERSION}-arm64.tgz $FLAGS +${ALIYUN} oss cp ./aliyun-cli-linux-"${VERSION}"-arm64.tgz "$FLAGS" # windows -${ALIYUN} oss cp ./aliyun-cli-windows-${VERSION}-amd64.zip $FLAGS +${ALIYUN} oss cp ./aliyun-cli-windows-"${VERSION}"-amd64.zip "$FLAGS" if [[ "$VERSION" == *"-beta" ]]; then echo "beta. skip." else - cp ./aliyun-cli-macosx-${VERSION}-amd64.tgz ./aliyun-cli-macosx-latest-amd64.tgz - ${ALIYUN} oss cp ./aliyun-cli-macosx-latest-amd64.tgz $FLAGS + cp ./aliyun-cli-macosx-"${VERSION}"-amd64.tgz ./aliyun-cli-macosx-latest-amd64.tgz + ${ALIYUN} oss cp ./aliyun-cli-macosx-latest-amd64.tgz "$FLAGS" - cp ./aliyun-cli-macosx-${VERSION}-arm64.tgz ./aliyun-cli-macosx-latest-arm64.tgz - ${ALIYUN} oss cp ./aliyun-cli-macosx-latest-arm64.tgz $FLAGS + cp ./aliyun-cli-macosx-"${VERSION}"-arm64.tgz ./aliyun-cli-macosx-latest-arm64.tgz + ${ALIYUN} oss cp ./aliyun-cli-macosx-latest-arm64.tgz "$FLAGS" - cp ./aliyun-cli-macosx-${VERSION}-universal.tgz ./aliyun-cli-macosx-latest-universal.tgz - ${ALIYUN} oss cp ./aliyun-cli-macosx-latest-universal.tgz $FLAGS + cp ./aliyun-cli-macosx-"${VERSION}"-universal.tgz ./aliyun-cli-macosx-latest-universal.tgz + ${ALIYUN} oss cp ./aliyun-cli-macosx-latest-universal.tgz "$FLAGS" - cp ./aliyun-cli-${VERSION}.pkg ./aliyun-cli-latest.pkg - ${ALIYUN} oss cp ./aliyun-cli-latest.pkg $FLAGS + cp ./aliyun-cli-"${VERSION}".pkg ./aliyun-cli-latest.pkg + ${ALIYUN} oss cp ./aliyun-cli-latest.pkg "$FLAGS" - cp ./aliyun-cli-linux-${VERSION}-amd64.tgz ./aliyun-cli-linux-latest-amd64.tgz - ${ALIYUN} oss cp ./aliyun-cli-linux-latest-amd64.tgz $FLAGS + cp ./aliyun-cli-linux-"${VERSION}"-amd64.tgz ./aliyun-cli-linux-latest-amd64.tgz + ${ALIYUN} oss cp ./aliyun-cli-linux-latest-amd64.tgz "$FLAGS" - cp ./aliyun-cli-linux-${VERSION}-arm64.tgz ./aliyun-cli-linux-latest-arm64.tgz - ${ALIYUN} oss cp ./aliyun-cli-linux-latest-arm64.tgz $FLAGS + cp ./aliyun-cli-linux-"${VERSION}"-arm64.tgz ./aliyun-cli-linux-latest-arm64.tgz + ${ALIYUN} oss cp ./aliyun-cli-linux-latest-arm64.tgz "$FLAGS" - cp ./aliyun-cli-windows-${VERSION}-amd64.zip ./aliyun-cli-windows-latest-amd64.zip - ${ALIYUN} oss cp ./aliyun-cli-windows-latest-amd64.zip $FLAGS + cp ./aliyun-cli-windows-"${VERSION}"-amd64.zip ./aliyun-cli-windows-latest-amd64.zip + ${ALIYUN} oss cp ./aliyun-cli-windows-latest-amd64.zip "$FLAGS" # local version - echo ${VERSION} > out/version - ${ALIYUN} oss cp out/version $FLAGS + echo "${VERSION}" > out/version + ${ALIYUN} oss cp out/version "$FLAGS" RELEASE_ID=$(curl -fsSL \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $GITHUB_TOKEN" \ -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/aliyun/aliyun-cli/releases/tags/v$VERSION | jq '.["id"]') + https://api.github.com/repos/aliyun/aliyun-cli/releases/tags/v"$VERSION" | jq '.["id"]') DATA='{"draft":false,"prerelease":false,"make_latest":true}' @@ -64,6 +64,6 @@ else -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $GITHUB_TOKEN" \ -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/aliyun/aliyun-cli/releases/$RELEASE_ID \ + https://api.github.com/repos/aliyun/aliyun-cli/releases/"$RELEASE_ID" \ -d "$DATA" fi diff --git a/tools/upload_asset.sh b/tools/upload_asset.sh index 47f5f730e..767a42584 100644 --- a/tools/upload_asset.sh +++ b/tools/upload_asset.sh @@ -5,19 +5,19 @@ ASSET=$2 if [[ $ASSET == *.tgz ]] then - TYPE=application/x-compressed-tar + TYPE=application/x-compressed-tar elif [[ $ASSET == *.txt ]] then - TYPE=text/plain + TYPE=text/plain else - TYPE=application/zip + TYPE=application/zip fi RELEASE_ID=$(curl -fsSL \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $GITHUB_TOKEN" \ -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/aliyun/aliyun-cli/releases/tags/$TAG | jq '.["id"]') + https://api.github.com/repos/aliyun/aliyun-cli/releases/tags/"$TAG" | jq '.["id"]') curl -fsSL \ -X POST \ @@ -25,5 +25,5 @@ curl -fsSL \ -H "Authorization: Bearer $GITHUB_TOKEN" \ -H "X-GitHub-Api-Version: 2022-11-28" \ -H "Content-Type: $TYPE" \ - "https://uploads.github.com/repos/aliyun/aliyun-cli/releases/$RELEASE_ID/assets?name=$(basename $ASSET)" \ + "https://uploads.github.com/repos/aliyun/aliyun-cli/releases/$RELEASE_ID/assets?name=$(basename "$ASSET")" \ --data-binary "@$ASSET"