diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 9bcd82168..a4b4fb256 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -35,7 +35,7 @@ jobs: pwd && ls cd ./scripts chmod +x ./publish.sh - . publish.sh + . publish.sh --runtime all - name: Get release content id: release_content diff --git a/scripts/publish.sh b/scripts/publish.sh index 19be293bd..6fc7661a6 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -15,8 +15,35 @@ repoDir=$(dirname $PWD) consoleDir=$repoDir/src/Ray.BiliBiliTool.Console publishDir=$consoleDir/bin/Publish version="" +runTime="" # -------------------------- +read_params_from_init_cmd() { + while [ $# -ne 0 ]; do + name="$1" + case "$name" in + -r | --runtime | -[Rr]untime) + shift + runTime="$1" + ;; + *) + say_err "Unknown argument \`$name\`" + exit 1 + ;; + esac + shift + done +} + +read_var_from_user() { + # runTime + if [ -z "$runTime" ]; then + read -p 'please input runTime("all" "win-x86" "win-x64" "win-arm64" "linux-x64" "linux-musl-x64" "linux-arm64" "linux-arm" "osx-x64")' runTime + else + echo "runTime: $runTime" + fi +} + get_version() { version=$(grep -oP '(?<=).*?(?=<\/Version>)' $repoDir/common.props) echo -e "current version: $version \n\n" @@ -87,6 +114,9 @@ publish_tencentScf() { } main() { + read_params_from_init_cmd $* + read_var_from_user + get_version # dotnet dependent @@ -95,12 +125,16 @@ main() { # self contained # https://learn.microsoft.com/zh-cn/dotnet/core/rid-catalog array=("win-x86" "win-x64" "win-arm64" "linux-x64" "linux-musl-x64" "linux-arm64" "linux-arm" "osx-x64") + if [ "$runTime" != "all" ]; then + array=("$runTime") + fi for i in "${array[@]}"; do - echo "$i" publish_self_contained $i done - publish_tencentScf + if [ "$runTime" == "all" ]; then + publish_tencentScf + fi } -main +main $*