curl: (26) 无法从 appcenter 中的文件/应用程序打开/读取本地数据

问题描述 投票:0回答:1

我正在尝试通过

app-release.apk
脚本使用 curl 命令将
appcenter post-build
文件从
https://appcenter.ms/
上传到 s3 存储桶,但出现此错误
curl: (26) Failed to open/read local data from file/application

这是我完整的

post-build
脚本

文件名:

appcenter-post-build.sh

if [ "$AGENT_JOBSTATUS" == "Succeeded" ]; then

    # Example: Upload main branch app binary to HockeyApp using the API
    echo "Current branch is $APPCENTER_BRANCH"
    if [ "$APPCENTER_BRANCH" == "staging" ];
     then
        curl \
        -F "status=2" \
        -F "file_stage=@$APPCENTER_OUTPUT_DIRECTORY/app-release.apk" \
        https://stag.api.website.com/v1/upload/android
        # curl --location 'https://stag.api.website.com/v1/upload/android' \
        # --form 'file_stage=@"$APPCENTER_OUTPUT_DIRECTORY/app-release.apk"'
    else
        echo "Current branch is $APPCENTER_BRANCH"
    fi
fi
bash curl visual-studio-app-center
1个回答
0
投票

我可以通过将文件路径名从

$APPCENTER_OUTPUT_DIRECTORY/app-release.apk
替换为
/Users/runner/work/1/s/android/app/build/outputs/apk/release/app-release.apk

来解决这个问题

我最终的工作代码是

if [ "$AGENT_JOBSTATUS" == "Succeeded" ]; then

    # Example: Upload main branch app binary to HockeyApp using the API
    echo "Current branch is $APPCENTER_BRANCH"
    if [ "$APPCENTER_BRANCH" == "staging" ];
     then
        curl \
        -F "status=2" \
        -F "file_stage=@/Users/runner/work/1/s/android/app/build/outputs/apk/release/app-release.apk" \
        -H 'Authorization: Bearer token' \
        https://stag.api.website.com/v1/upload/android
    else
        echo "Current branch is $APPCENTER_BRANCH"
    fi
fi
© www.soinside.com 2019 - 2024. All rights reserved.