openai/openai-python
Publicmirrored from https://github.com/openai/openai-pythonAvailable
scripts/utils/upload-artifact.sh
27lines · modeblame
98925cefstainless-app[bot]1 years ago | 1 | #!/usr/bin/env bash |
| 2 | set -exuo pipefail | |
| 3 | | |
be1f58f0stainless-app[bot]12 months ago | 4 | FILENAME=$(basename dist/*.whl) |
| 5 | | |
| 6 | RESPONSE=$(curl -X POST "$URL?filename=$FILENAME" \ | |
98925cefstainless-app[bot]1 years ago | 7 | -H "Authorization: Bearer $AUTH" \ |
| 8 | -H "Content-Type: application/json") | |
| 9 | | |
| 10 | SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url') | |
| 11 | | |
| 12 | if [[ "$SIGNED_URL" == "null" ]]; then | |
| 13 | echo -e "\033[31mFailed to get signed URL.\033[0m" | |
| 14 | exit 1 | |
| 15 | fi | |
| 16 | | |
be1f58f0stainless-app[bot]12 months ago | 17 | UPLOAD_RESPONSE=$(curl -v -X PUT \ |
| 18 | -H "Content-Type: binary/octet-stream" \ | |
| 19 | --data-binary "@dist/$FILENAME" "$SIGNED_URL" 2>&1) | |
98925cefstainless-app[bot]1 years ago | 20 | |
| 21 | if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then | |
| 22 | echo -e "\033[32mUploaded build to Stainless storage.\033[0m" | |
be1f58f0stainless-app[bot]12 months ago | 23 | echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/openai-python/$SHA/$FILENAME'\033[0m" |
98925cefstainless-app[bot]1 years ago | 24 | else |
| 25 | echo -e "\033[31mFailed to upload artifact.\033[0m" | |
| 26 | exit 1 | |
| 27 | fi |