Skip to content

Commit bbda5d3

Browse files
stainless-app[bot]RobertCraigie
authored andcommitted
chore(internal): upload builds and expand CI branch coverage
1 parent 66cf6d4 commit bbda5d3

File tree

2 files changed

+50
-11
lines changed

2 files changed

+50
-11
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
name: CI
22
on:
33
push:
4-
branches:
5-
- main
6-
- alpha
7-
pull_request:
8-
branches:
9-
- main
10-
- next
11-
- alpha
4+
branches-ignore:
5+
- 'generated'
6+
- 'codegen/**'
7+
- 'integrated/**'
8+
- 'preview-head/**'
9+
- 'preview-base/**'
10+
- 'preview/**'
1211

1312
jobs:
1413
lint:
1514
name: lint
1615
runs-on: ubuntu-latest
17-
1816
steps:
1917
- uses: actions/checkout@v4
2018

@@ -32,7 +30,9 @@ jobs:
3230
build:
3331
name: build
3432
runs-on: ubuntu-latest
35-
33+
permissions:
34+
contents: read
35+
id-token: write
3636
steps:
3737
- uses: actions/checkout@v4
3838

@@ -46,10 +46,24 @@ jobs:
4646

4747
- name: Check build
4848
run: ./scripts/build
49+
50+
- name: Get GitHub OIDC Token
51+
if: github.repository == 'stainless-sdks/anthropic-typescript'
52+
id: github-oidc
53+
uses: actions/github-script@v6
54+
with:
55+
script: core.setOutput('github_token', await core.getIDToken());
56+
57+
- name: Upload tarball
58+
if: github.repository == 'stainless-sdks/anthropic-typescript'
59+
env:
60+
URL: https://pkg.stainless.com/s
61+
AUTH: ${{ steps.github-oidc.outputs.github_token }}
62+
SHA: ${{ github.sha }}
63+
run: ./scripts/utils/upload-artifact.sh
4964
test:
5065
name: test
5166
runs-on: ubuntu-latest
52-
5367
steps:
5468
- uses: actions/checkout@v4
5569

scripts/utils/upload-artifact.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -exuo pipefail
3+
4+
RESPONSE=$(curl -X POST "$URL" \
5+
-H "Authorization: Bearer $AUTH" \
6+
-H "Content-Type: application/json")
7+
8+
SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url')
9+
10+
if [[ "$SIGNED_URL" == "null" ]]; then
11+
echo -e "\033[31mFailed to get signed URL.\033[0m"
12+
exit 1
13+
fi
14+
15+
UPLOAD_RESPONSE=$(tar -cz dist | curl -v -X PUT \
16+
-H "Content-Type: application/gzip" \
17+
--data-binary @- "$SIGNED_URL" 2>&1)
18+
19+
if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
20+
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
21+
echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/anthropic-typescript/$SHA'\033[0m"
22+
else
23+
echo -e "\033[31mFailed to upload artifact.\033[0m"
24+
exit 1
25+
fi

0 commit comments

Comments
 (0)