File tree Expand file tree Collapse file tree 2 files changed +50
-9
lines changed Expand file tree Collapse file tree 2 files changed +50
-9
lines changed Original file line number Diff line number Diff line change 1
1
name : CI
2
2
on :
3
3
push :
4
- branches :
5
- - master
6
- pull_request :
7
- branches :
8
- - master
9
- - next
10
- - alpha
4
+ branches-ignore :
5
+ - ' generated '
6
+ - ' codegen/** '
7
+ - ' integrated/** '
8
+ - ' preview-head/** '
9
+ - ' preview-base/** '
10
+ - ' preview/** '
11
11
12
12
jobs :
13
13
lint :
14
14
name : lint
15
15
runs-on : ubuntu-latest
16
-
17
16
steps :
18
17
- uses : actions/checkout@v4
19
18
32
31
name : build
33
32
runs-on : ubuntu-latest
34
33
34
+ permissions :
35
+ contents : read
36
+ id-token : write
35
37
steps :
36
38
- uses : actions/checkout@v4
37
39
@@ -45,10 +47,24 @@ jobs:
45
47
46
48
- name : Check build
47
49
run : ./scripts/build
50
+
51
+ - name : Get GitHub OIDC Token
52
+ if : github.repository == 'stainless-sdks/openai-typescript'
53
+ id : github-oidc
54
+ uses : actions/github-script@v6
55
+ with :
56
+ script : core.setOutput('github_token', await core.getIDToken());
57
+
58
+ - name : Upload tarball
59
+ if : github.repository == 'stainless-sdks/openai-typescript'
60
+ env :
61
+ URL : https://pkg.stainless.com/s
62
+ AUTH : ${{ steps.github-oidc.outputs.github_token }}
63
+ SHA : ${{ github.sha }}
64
+ run : ./scripts/utils/upload-artifact.sh
48
65
test :
49
66
name : test
50
67
runs-on : ubuntu-latest
51
-
52
68
steps :
53
69
- uses : actions/checkout@v4
54
70
Original file line number Diff line number Diff line change
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/openai-typescript/$SHA '\033[0m"
22
+ else
23
+ echo -e " \033[31mFailed to upload artifact.\033[0m"
24
+ exit 1
25
+ fi
You can’t perform that action at this time.
0 commit comments