File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 - name : Configure Git for access to the Go SDK's staging repo
1818 if : github.repository == 'stainless-sdks/openai-cli'
1919 shell : bash
20- run : git config --global url."https://x-access-token:${{ steps.get_token.outputs.github_access_token }}@github.com/stainless-sdks/openai-go".insteadOf "https://github.com/stainless-sdks/openai-go"
20+ env :
21+ GITHUB_ACCESS_TOKEN : ${{ steps.get_token.outputs.github_access_token }}
22+ run : |
23+ {
24+ echo "GIT_CONFIG_COUNT=1"
25+ echo "GIT_CONFIG_KEY_0=url.https://x-access-token:${GITHUB_ACCESS_TOKEN}@github.com/stainless-sdks/openai-go.insteadOf"
26+ echo "GIT_CONFIG_VALUE_0=https://github.com/stainless-sdks/openai-go"
27+ } >> "$GITHUB_ENV"
2128
2229 - name : Setup go
2330 uses : actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
Original file line number Diff line number Diff line change 11name : CI
2+ permissions :
3+ contents : read
24on :
35 push :
46 branches :
3537
3638 - name : Link staging branch
3739 if : github.repository == 'stainless-sdks/openai-cli'
40+ env :
41+ GO_SDK_REPLACEMENT : github.com/stainless-sdks/openai-go/v3@${{ github.ref_name }}
3842 run : |
39- ./scripts/link 'github.com/stainless-sdks/openai-go/v3@${{ github.ref_name }}' || true
43+ ./scripts/link "$GO_SDK_REPLACEMENT" || true
4044
4145 - name : Bootstrap
4246 run : ./scripts/bootstrap
6367
6468 - name : Link staging branch
6569 if : github.repository == 'stainless-sdks/openai-cli'
70+ env :
71+ GO_SDK_REPLACEMENT : github.com/stainless-sdks/openai-go/v3@${{ github.ref_name }}
6672 run : |
67- ./scripts/link 'github.com/stainless-sdks/openai-go/v3@${{ github.ref_name }}' || true
73+ ./scripts/link "$GO_SDK_REPLACEMENT" || true
6874
6975 - name : Bootstrap
7076 run : ./scripts/bootstrap
@@ -116,8 +122,10 @@ jobs:
116122
117123 - name : Link staging branch
118124 if : github.repository == 'stainless-sdks/openai-cli'
125+ env :
126+ GO_SDK_REPLACEMENT : github.com/stainless-sdks/openai-go/v3@${{ github.ref_name }}
119127 run : |
120- ./scripts/link 'github.com/stainless-sdks/openai-go/v3@${{ github.ref_name }}' || true
128+ ./scripts/link "$GO_SDK_REPLACEMENT" || true
121129
122130 - name : Bootstrap
123131 run : ./scripts/bootstrap
Original file line number Diff line number Diff line change 1212 if : github.ref == 'refs/heads/main' && github.repository == 'openai/openai-cli'
1313 runs-on : ubuntu-latest
1414 environment : publish
15- permissions :
16- contents : write
15+ permissions : {}
1716
1817 steps :
19- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
20- with :
21- persist-credentials : false
22-
2318 - uses : stainless-api/trigger-release-please@bb6677c5a04578eec1ccfd9e1913b5b78ed64c61 # v1.4.0
2419 id : release
2520 with :
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
2- set -exuo pipefail
2+ set -euo pipefail
33
44BINARY_NAME=" openai"
55DIST_DIR=" dist"
3535
3636(cd " $DIST_DIR " && zip -r " $FILENAME " " ${relative_files[@]} " )
3737
38- RESPONSE=$( curl -X POST " $URL ?filename=$FILENAME " \
38+ RESPONSE=$( curl --fail-with-body -sS - X POST " $URL ?filename=$FILENAME " \
3939 -H " Authorization: Bearer $AUTH " \
4040 -H " Content-Type: application/json" )
4141
@@ -46,14 +46,15 @@ if [[ "$SIGNED_URL" == "null" ]]; then
4646 exit 1
4747fi
4848
49- UPLOAD_RESPONSE =$( curl -v -X PUT \
49+ if UPLOAD_STATUS =$( curl -sS -X PUT \
5050 -H " Content-Type: application/zip" \
51- --data-binary " @${DIST_DIR} /${FILENAME} " " $SIGNED_URL " 2>&1 )
52-
53- if echo " $UPLOAD_RESPONSE " | grep -q " HTTP/[0-9.]* 200" ; then
51+ --data-binary " @${DIST_DIR} /${FILENAME} " \
52+ --output /dev/null \
53+ --write-out " %{http_code}" \
54+ " $SIGNED_URL " ) && [[ " $UPLOAD_STATUS " == " 200" ]]; then
5455 echo -e " \033[32mUploaded build to Stainless storage.\033[0m"
5556 echo -e " \033[32mInstallation: Download and unzip: 'https://pkg.stainless.com/s/openai-cli/$SHA '. On macOS, run 'xattr -d com.apple.quarantine {executable name}'.\033[0m"
5657else
57- echo -e " \033[31mFailed to upload artifact.\033[0m"
58+ echo -e " \033[31mFailed to upload artifact. HTTP status: ${UPLOAD_STATUS :- curl failed} . \033[0m"
5859 exit 1
5960fi
You can’t perform that action at this time.
0 commit comments