Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/actions/setup-go/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,19 @@ runs:
- name: Configure Git for access to the Go SDK's staging repo
if: github.repository == 'stainless-sdks/openai-cli'
shell: bash
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"
env:
GITHUB_ACCESS_TOKEN: ${{ steps.get_token.outputs.github_access_token }}
run: |
git_config_global="${RUNNER_TEMP}/stainless-gitconfig"
if [[ -f "${HOME}/.gitconfig" ]]; then
cp "${HOME}/.gitconfig" "$git_config_global"
else
touch "$git_config_global"
fi
chmod 600 "$git_config_global"
token_username="x-access-token"
git config --file "$git_config_global" url."https://${token_username}:${GITHUB_ACCESS_TOKEN}@github.com/stainless-sdks/openai-go".insteadOf "https://github.com/stainless-sdks/openai-go"
echo "GIT_CONFIG_GLOBAL=$git_config_global" >> "$GITHUB_ENV"

- name: Setup go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: CI
permissions:
contents: read
on:
push:
branches:
Expand Down Expand Up @@ -35,8 +37,10 @@ jobs:

- name: Link staging branch
if: github.repository == 'stainless-sdks/openai-cli'
env:
GO_SDK_REPLACEMENT: github.com/stainless-sdks/openai-go/v3@${{ github.ref_name }}
run: |
./scripts/link 'github.com/stainless-sdks/openai-go/v3@${{ github.ref_name }}' || true
./scripts/link "$GO_SDK_REPLACEMENT" || true

- name: Bootstrap
run: ./scripts/bootstrap
Expand All @@ -63,8 +67,10 @@ jobs:

- name: Link staging branch
if: github.repository == 'stainless-sdks/openai-cli'
env:
GO_SDK_REPLACEMENT: github.com/stainless-sdks/openai-go/v3@${{ github.ref_name }}
run: |
./scripts/link 'github.com/stainless-sdks/openai-go/v3@${{ github.ref_name }}' || true
./scripts/link "$GO_SDK_REPLACEMENT" || true

- name: Bootstrap
run: ./scripts/bootstrap
Expand Down Expand Up @@ -116,8 +122,10 @@ jobs:

- name: Link staging branch
if: github.repository == 'stainless-sdks/openai-cli'
env:
GO_SDK_REPLACEMENT: github.com/stainless-sdks/openai-go/v3@${{ github.ref_name }}
run: |
./scripts/link 'github.com/stainless-sdks/openai-go/v3@${{ github.ref_name }}' || true
./scripts/link "$GO_SDK_REPLACEMENT" || true

- name: Bootstrap
run: ./scripts/bootstrap
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/create-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,9 @@ jobs:
if: github.ref == 'refs/heads/main' && github.repository == 'openai/openai-cli'
runs-on: ubuntu-latest
environment: publish
permissions:
contents: write
permissions: {}

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false

- uses: stainless-api/trigger-release-please@bb6677c5a04578eec1ccfd9e1913b5b78ed64c61 # v1.4.0
id: release
with:
Expand Down
12 changes: 6 additions & 6 deletions scripts/utils/upload-artifact.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -exuo pipefail
set -euo pipefail

BINARY_NAME="openai"
DIST_DIR="dist"
Expand Down Expand Up @@ -35,7 +35,7 @@ done

(cd "$DIST_DIR" && zip -r "$FILENAME" "${relative_files[@]}")

RESPONSE=$(curl -X POST "$URL?filename=$FILENAME" \
RESPONSE=$(curl --fail-with-body -sS -X POST "$URL?filename=$FILENAME" \
-H "Authorization: Bearer $AUTH" \
-H "Content-Type: application/json")

Expand All @@ -46,11 +46,11 @@ if [[ "$SIGNED_URL" == "null" ]]; then
exit 1
fi

UPLOAD_RESPONSE=$(curl -v -X PUT \
if curl --fail-with-body -sS -X PUT \
-H "Content-Type: application/zip" \
--data-binary "@${DIST_DIR}/${FILENAME}" "$SIGNED_URL" 2>&1)

if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
--data-binary "@${DIST_DIR}/${FILENAME}" \
--output /dev/null \
"$SIGNED_URL"; then
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
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"
else
Expand Down
Loading