Skip to content

Commit e75a707

Browse files
committed
feat: separate legacy compat action and build action
1 parent e9f39bd commit e75a707

17 files changed

Lines changed: 30381 additions & 959 deletions

.gitlab-ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This file defines reusable GitLab CI component for uploading OpenAPI specs to Stainless
2+
3+
image: node:20-alpine
4+
5+
.upload-openapi-spec:
6+
script:
7+
- apk add --no-cache git
8+
- git clone https://github.com/stainless-api/upload-openapi-spec-action.git
9+
- cd upload-openapi-spec-action
10+
- node dist/index.js
11+
variables:
12+
INPUT_STAINLESS_API_KEY: $STAINLESS_API_KEY
13+
INPUT_INPUT_PATH: $INPUT_PATH
14+
INPUT_CONFIG_PATH: $CONFIG_PATH
15+
INPUT_OUTPUT_PATH: $OUTPUT_PATH
16+
INPUT_PROJECT_NAME: $PROJECT_NAME
17+
INPUT_COMMIT_MESSAGE: $COMMIT_MESSAGE
18+
INPUT_GUESS_CONFIG: $GUESS_CONFIG
19+
INPUT_BRANCH: $BRANCH

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ and integration with docs platforms, see the [examples directory](./examples).
9595
9696
This repository provides three GitHub actions.
9797
98-
- `stainless-api/upload-openapi-spec-action`: Build SDKs for a Stainless
98+
- `stainless-api/upload-openapi-spec-action/build`: Build SDKs for a Stainless
9999
project. For information about the input parameters, see the [action
100-
definition](./action.yml).
100+
definition](./build/action.yml).
101101

102102
- `stainless-api/upload-openapi-spec-action/preview`: Preview changes to SDKs
103103
introduced by a pull request. For information about the input parameters, see

action.yml

Lines changed: 17 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# This action is provided for backward-compatibility purposes; do not use it
2+
# for new projects. Instead, use `upload-openapi-spec-action/build`.
3+
14
name: Stainless — Build SDK
25
description: Build SDKs
36
branding:
@@ -8,100 +11,27 @@ runs:
811
main: dist/index.js
912
inputs:
1013
stainless_api_key:
11-
description: Stainless API key.
14+
description: "Stainless API key."
1215
required: true
13-
project:
14-
description: Stainless project name.
16+
input_path:
17+
description: "Path to the OpenAPI file."
1518
required: true
16-
oas_path:
17-
description: >-
18-
Path to your OpenAPI spec. If omitted, and `merge_branch` is false,
19-
will use the existing OpenAPI spec on the Stainless branch.
20-
required: false
2119
config_path:
22-
description: >-
23-
Path to your Stainless config. If omitted, and `merge_branch` is false,
24-
will use the existing Stainless config on the Stainless branch.
20+
description: "Path to the Stainless config file."
2521
required: false
22+
output_path:
23+
description: "Output path for the decorated OpenAPI spec."
24+
project_name:
25+
description: "Stainless project name."
26+
required: true
2627
commit_message:
27-
description: >-
28-
Commit message to use in the commits in the SDK repo. Use a commit
29-
message in the conventional commits format:
30-
https://www.conventionalcommits.org/en/v1.0.0/
28+
description: "Commit message to use in the commits in the SDK repo."
3129
required: false
3230
guess_config:
33-
description: >-
34-
If true, update the existing Stainless config file based on the OpenAPI
35-
spec. Cannot be specified if `config_path` is specified.
31+
description: "If true, renegerate the endpoints in the Stainless config file."
3632
required: false
37-
default: false
33+
default: "false"
3834
branch:
39-
description: Stainless branch to create the build on.
40-
required: false
41-
default: main
42-
merge_branch:
43-
description: >-
44-
Stainless branch to merge changes from. The OpenAPI spec and Stainless
45-
config from the `merge_branch` will be used to create a build on top of
46-
the Stainless branch.
47-
required: false
48-
base_revision:
49-
description: >-
50-
A base revision to compare this build against. Must be a config commit
51-
SHA. Cannot be specified if `merge_branch` is specified.
35+
description: "If true, renegerate the endpoints in the Stainless config file."
5236
required: false
53-
base_branch:
54-
description: >-
55-
Stainless branch to create the base build on. Must be specified if
56-
`base_revision` is specified.
57-
required: false
58-
output_dir:
59-
description: >-
60-
Directory to write output files to. Defaults to the runner's temporary
61-
directory.
62-
required: false
63-
default: ${{ runner.temp }}
64-
65-
outputs:
66-
outcomes:
67-
description: >-
68-
JSON-stringified object of build outcomes. Keys are languages, and values
69-
contain the `commit` result of the build for that language. Will look
70-
like:
71-
72-
```
73-
{
74-
"typescript": {
75-
"conclusion": "success",
76-
"commit": {
77-
"sha": "...",
78-
...
79-
},
80-
},
81-
...
82-
}
83-
```
84-
base_outcomes:
85-
description: >-
86-
JSON-stringified object of base build outcomes. Present when
87-
`base_revision` is specified. Keys are languages, and values contain the
88-
`commit` result of the build for that language. Will look like:
89-
90-
```
91-
{
92-
"typescript": {
93-
"conclusion": "success",
94-
"commit": {
95-
"sha": "...",
96-
...
97-
},
98-
},
99-
...
100-
}
101-
```
102-
documented_spec_path:
103-
description: >-
104-
Path to an OpenAPI spec with SDK code samples. Present when `output_dir`
105-
is specified and `code_samples` is in your Stainless config. See
106-
https://app.stainless.com/docs/reference/config#open-api-config for
107-
more details.
37+
default: "main"

build/action.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Stainless — Build SDK
2+
description: Build SDKs
3+
branding:
4+
icon: book-open
5+
color: green
6+
runs:
7+
using: node20
8+
main: dist/build.js
9+
inputs:
10+
stainless_api_key:
11+
description: Stainless API key.
12+
required: true
13+
project:
14+
description: Stainless project name.
15+
required: true
16+
oas_path:
17+
description: >-
18+
Path to your OpenAPI spec. If omitted, and `merge_branch` is false,
19+
will use the existing OpenAPI spec on the Stainless branch.
20+
required: false
21+
config_path:
22+
description: >-
23+
Path to your Stainless config. If omitted, and `merge_branch` is false,
24+
will use the existing Stainless config on the Stainless branch.
25+
required: false
26+
commit_message:
27+
description: >-
28+
Commit message to use in the commits in the SDK repo. Use a commit
29+
message in the conventional commits format:
30+
https://www.conventionalcommits.org/en/v1.0.0/
31+
required: false
32+
guess_config:
33+
description: >-
34+
If true, update the existing Stainless config file based on the OpenAPI
35+
spec. Cannot be specified if `config_path` is specified.
36+
required: false
37+
default: false
38+
branch:
39+
description: Stainless branch to create the build on.
40+
required: false
41+
default: main
42+
merge_branch:
43+
description: >-
44+
Stainless branch to merge changes from. The OpenAPI spec and Stainless
45+
config from the `merge_branch` will be used to create a build on top of
46+
the Stainless branch.
47+
required: false
48+
base_revision:
49+
description: >-
50+
A base revision to compare this build against. Must be a config commit
51+
SHA. Cannot be specified if `merge_branch` is specified.
52+
required: false
53+
base_branch:
54+
description: >-
55+
Stainless branch to create the base build on. Must be specified if
56+
`base_revision` is specified.
57+
required: false
58+
output_dir:
59+
description: >-
60+
Directory to write output files to. Defaults to the runner's temporary
61+
directory.
62+
required: false
63+
default: ${{ runner.temp }}
64+
65+
outputs:
66+
outcomes:
67+
description: >-
68+
JSON-stringified object of build outcomes. Keys are languages, and values
69+
contain the `commit` result of the build for that language. Will look
70+
like:
71+
72+
```
73+
{
74+
"typescript": {
75+
"conclusion": "success",
76+
"commit": {
77+
"sha": "...",
78+
...
79+
},
80+
},
81+
...
82+
}
83+
```
84+
base_outcomes:
85+
description: >-
86+
JSON-stringified object of base build outcomes. Present when
87+
`base_revision` is specified. Keys are languages, and values contain the
88+
`commit` result of the build for that language. Will look like:
89+
90+
```
91+
{
92+
"typescript": {
93+
"conclusion": "success",
94+
"commit": {
95+
"sha": "...",
96+
...
97+
},
98+
},
99+
...
100+
}
101+
```
102+
documented_spec_path:
103+
description: >-
104+
Path to an OpenAPI spec with SDK code samples. Present when `output_dir`
105+
is specified and `code_samples` is in your Stainless config. See
106+
https://app.stainless.com/docs/reference/config#open-api-config for
107+
more details.

0 commit comments

Comments
 (0)