Skip to content

Commit 095eea0

Browse files
authored
feat: add openapi workflow
feat: add openapi workflow
2 parents 594aae2 + b22f726 commit 095eea0

2 files changed

Lines changed: 117 additions & 4 deletions

File tree

.github/workflows/deploy-openapi-assets.yml

Lines changed: 115 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,125 @@ on:
44
push:
55
branches: [main]
66
paths:
7-
- 'packages/openapi/**'
7+
- "packages/openapi/**"
88

99
jobs:
10-
trigger:
10+
pack:
1111
runs-on: ubuntu-latest
1212
environment: production
13+
permissions:
14+
contents: read
15+
outputs:
16+
version: ${{ steps.set-outputs.outputs.version }}
17+
packfile_name: ${{ steps.set-outputs.outputs.packfile_name }}
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: "20"
26+
27+
- id: set-outputs
28+
name: Pack @docs/openapi and upload artifacts
29+
run: |
30+
set -euo pipefail
31+
cd packages/openapi
32+
33+
echo "Working dir: $(pwd)"
34+
cat package.json
35+
36+
npm ci
37+
38+
# npm pack prints the filename; grab the last non-empty line
39+
PACKFILE=$(npm pack | sed -n '/./p' | tail -n1)
40+
echo "Packed file: $PACKFILE"
41+
42+
# create stable 'latest' name
43+
LATEST_NAME="openapi-latest.tgz"
44+
cp -f "$PACKFILE" "$LATEST_NAME"
45+
46+
# ensure files exist
47+
ls -la
48+
49+
VERSION=$(node -p "require('./package.json').version")
50+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
51+
echo "packfile_name=$PACKFILE" >> "$GITHUB_OUTPUT"
52+
53+
- name: Upload tarballs as artifact
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: openapi-tarballs
57+
path: |
58+
packages/openapi/${{ steps.set-outputs.outputs.packfile_name }}
59+
packages/openapi/openapi-latest.tgz
60+
61+
release-openapi-packages:
62+
runs-on: ubuntu-latest
63+
needs: pack
64+
environment: production
65+
permissions:
66+
contents: write
67+
steps:
68+
- name: Checkout (needed for workspace)
69+
uses: actions/checkout@v4
70+
71+
- name: Download packed artifacts
72+
uses: actions/download-artifact@v4
73+
with:
74+
name: openapi-tarballs
75+
path: artifacts
76+
77+
- name: Show artifacts (debug)
78+
run: ls -la artifacts || true
79+
80+
- name: Resolve artifact paths
81+
id: find
82+
run: |
83+
set -euo pipefail
84+
PACKFILE="${{ needs.pack.outputs.packfile_name }}"
85+
PACK_PATH=$(find artifacts -type f -name "$PACKFILE" -print -quit || true)
86+
LATEST_PATH=$(find artifacts -type f -name "openapi-latest.tgz" -print -quit || true)
87+
88+
echo "Found pack path: $PACK_PATH"
89+
echo "Found latest path: $LATEST_PATH"
90+
if [ -z "$PACK_PATH" ] || [ -z "$LATEST_PATH" ]; then
91+
echo "::error::Missing artifact(s). Debug listing:"
92+
ls -Rla artifacts || true
93+
exit 1
94+
fi
95+
96+
echo "pack_path=$PACK_PATH" >> "$GITHUB_OUTPUT"
97+
echo "latest_path=$LATEST_PATH" >> "$GITHUB_OUTPUT"
98+
99+
- name: Create or update tagged release and upload versioned tarball
100+
id: gh_release_tag
101+
uses: softprops/action-gh-release@v1
102+
with:
103+
tag_name: "openapi-v${{ needs.pack.outputs.version }}"
104+
name: "openapi v${{ needs.pack.outputs.version }}"
105+
body: "Automated release for packages/openapi (pack + upload)"
106+
files: ${{ steps.find.outputs.pack_path }}
107+
env:
108+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109+
110+
- name: Create or update 'latest' release and upload stable tarball
111+
id: gh_release_latest
112+
uses: softprops/action-gh-release@v1
113+
with:
114+
tag_name: "openapi-latest"
115+
name: "openapi latest"
116+
body: "Automated release for packages/openapi (latest)"
117+
files: ${{ steps.find.outputs.latest_path }}
118+
env:
119+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120+
121+
rebuild-schema:
122+
runs-on: ubuntu-latest
123+
environment: production
124+
needs:
125+
- release-openapi-packages
13126
steps:
14127
- name: Trigger autoupdate swagger
15128
env:

packages/openapi/descriptions/assistant-thread.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ export default {
99
desc: `The object type.`,
1010
},
1111
role: {
12-
desc: `The role of the entity that is creating the Message`,
12+
desc: `The role of the entity that is creating the Message.`,
1313
},
1414
content: {
1515
text: {
16-
desc: `The text contents of the Message`,
16+
desc: `The text contents of the Message.`,
1717
},
1818
array: {
1919
desc: `An array of content parts with a defined type, each can be of type text or images can be passed with image_url or image_file`,

0 commit comments

Comments
 (0)