Skip to content

Commit d81a857

Browse files
committed
ci: update to upstream structure
1 parent 83b9be3 commit d81a857

File tree

3 files changed

+29
-24
lines changed

3 files changed

+29
-24
lines changed

.github/workflows/follow-up.yaml

+26-18
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
11
name: Follow Up
22

3-
on: workflow_dispatch
4-
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
run-id:
7+
description: docs page GHA run id
8+
required: true
9+
type: string
510
jobs:
611
follow-up:
712
runs-on: ubuntu-latest
813
steps:
9-
- uses: actions/checkout@v2
10-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
15+
- uses: actions/download-artifact@v4
1116
with:
12-
repository: solvedac/unofficial-documentation
17+
name: github-pages
1318
path: unofficial-documentation
14-
- uses: actions/setup-java@v2
19+
repository: solvedac/unofficial-documentation
20+
github-token: ${{ secrets.PAT_FOLLOW_UP }}
21+
run-id: ${{ github.event.inputs.run-id }}
22+
- run: tar -xf artifact.tar ./tsp-output/@typespec/openapi3/openapi.yaml
23+
working-directory: unofficial-documentation
24+
- run: ls -R
25+
- uses: actions/setup-java@v4
1526
with:
16-
distribution: adopt
17-
java-version: 11
18-
- uses: actions/setup-node@v2
27+
distribution: temurin
28+
java-version: 21
29+
- uses: actions/setup-node@v4
1930
- name: Install Dependencies
2031
run: npm install
21-
- name: Override OpenAPI Version to 3.0.x (generator does not support 3.1)
22-
run: |
23-
for file in `find unofficial-documentation/src -type f`; do
24-
sed -i 's/openapi: "3.1.0"/openapi: "3.0.0"/' $file
25-
done
2632
- name: Generate
27-
run: npm run generate
33+
run: npx @openapitools/openapi-generator-cli batch --clean typescript-fetch.yaml
2834
- name: Tricky TSC Safety
2935
run: |
3036
sed -i 's/fetchApi(): FetchAPI/fetchApi(): FetchAPI | undefined/' src/runtime.ts
@@ -40,18 +46,20 @@ jobs:
4046
run: npm run build
4147
- name: Update Version
4248
run: |
43-
sed -ri "s/\"version\": \"[^\"]+\"/\"version\": \"`sed -rn 's/^.* version: "([^"]+)".*$/\1/p' unofficial-documentation/src/openapi.yaml`\"/" package.json
49+
file=unofficial-documentation/tsp-output/@typespec/openapi3/openapi.yaml
50+
version=$(sed -rn 's/\s+version:\s*"([^"]+)"/\1/p' $file | sed -rn 's/\.0+([0-9]+)/.\1/p')
51+
sed -ri "s/\"version\": \"[^\"]+\"/\"version\": \"$version\"/" package.json
4452
- name: Make Deno Friendly
4553
run: |
4654
for file in `find src -type f -name "index.ts"`; do
4755
cp $file `echo $file | sed s/index/mod/`
4856
done
4957
- name: Create Pull Request
50-
uses: peter-evans/create-pull-request@v3
58+
uses: peter-evans/create-pull-request@v6
5159
with:
5260
commit-message: Follow-up solvedac/unofficial-documentation
5361
title: Follow-up solvedac/unofficial-documentation
5462
body: |
55-
This Pull Request will update the typescript sources.
63+
This Pull Request will update the sources based on upstream docs.
5664
It is automatically created by GitHub Actions.
5765
labels: follow-up

package.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
}
3232
},
3333
"scripts": {
34-
"generate": "openapi-generator-cli batch --clean typescript-fetch.yaml",
35-
"build": "rimraf dist && tsc"
34+
"build": "rm -rf dist && tsc"
3635
},
3736
"repository": {
3837
"type": "git",
@@ -45,8 +44,6 @@
4544
},
4645
"homepage": "https://github.com/solvedac/api.ts#readme",
4746
"devDependencies": {
48-
"@openapitools/openapi-generator-cli": "^2.4.1",
49-
"rimraf": "^3.0.2",
50-
"typescript": "^4.4.2"
47+
"typescript": "^5.4.5"
5148
}
5249
}

typescript-fetch.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
inputSpec: "unofficial-documentation/src/openapi.yaml"
1+
inputSpec: "unofficial-documentation/tsp-output/@typespec/openapi3/openapi.yaml"
22
generatorName: "typescript-fetch"
33
outputDir: "src"
44
validateSpec: false

0 commit comments

Comments
 (0)