Skip to content

Commit

Permalink
ci: update to upstream structure
Browse files Browse the repository at this point in the history
  • Loading branch information
RanolP committed Apr 27, 2024
1 parent 83b9be3 commit d81a857
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
44 changes: 26 additions & 18 deletions .github/workflows/follow-up.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
name: Follow Up

on: workflow_dispatch

on:
workflow_dispatch:
inputs:
run-id:
description: docs page GHA run id
required: true
type: string
jobs:
follow-up:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
repository: solvedac/unofficial-documentation
name: github-pages
path: unofficial-documentation
- uses: actions/setup-java@v2
repository: solvedac/unofficial-documentation
github-token: ${{ secrets.PAT_FOLLOW_UP }}
run-id: ${{ github.event.inputs.run-id }}
- run: tar -xf artifact.tar ./tsp-output/@typespec/openapi3/openapi.yaml
working-directory: unofficial-documentation
- run: ls -R
- uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 11
- uses: actions/setup-node@v2
distribution: temurin
java-version: 21
- uses: actions/setup-node@v4
- name: Install Dependencies
run: npm install
- name: Override OpenAPI Version to 3.0.x (generator does not support 3.1)
run: |
for file in `find unofficial-documentation/src -type f`; do
sed -i 's/openapi: "3.1.0"/openapi: "3.0.0"/' $file
done
- name: Generate
run: npm run generate
run: npx @openapitools/openapi-generator-cli batch --clean typescript-fetch.yaml
- name: Tricky TSC Safety
run: |
sed -i 's/fetchApi(): FetchAPI/fetchApi(): FetchAPI | undefined/' src/runtime.ts
Expand All @@ -40,18 +46,20 @@ jobs:
run: npm run build
- name: Update Version
run: |
sed -ri "s/\"version\": \"[^\"]+\"/\"version\": \"`sed -rn 's/^.* version: "([^"]+)".*$/\1/p' unofficial-documentation/src/openapi.yaml`\"/" package.json
file=unofficial-documentation/tsp-output/@typespec/openapi3/openapi.yaml
version=$(sed -rn 's/\s+version:\s*"([^"]+)"/\1/p' $file | sed -rn 's/\.0+([0-9]+)/.\1/p')
sed -ri "s/\"version\": \"[^\"]+\"/\"version\": \"$version\"/" package.json
- name: Make Deno Friendly
run: |
for file in `find src -type f -name "index.ts"`; do
cp $file `echo $file | sed s/index/mod/`
done
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v6
with:
commit-message: Follow-up solvedac/unofficial-documentation
title: Follow-up solvedac/unofficial-documentation
body: |
This Pull Request will update the typescript sources.
This Pull Request will update the sources based on upstream docs.
It is automatically created by GitHub Actions.
labels: follow-up
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
}
},
"scripts": {
"generate": "openapi-generator-cli batch --clean typescript-fetch.yaml",
"build": "rimraf dist && tsc"
"build": "rm -rf dist && tsc"
},
"repository": {
"type": "git",
Expand All @@ -45,8 +44,6 @@
},
"homepage": "https://github.com/solvedac/api.ts#readme",
"devDependencies": {
"@openapitools/openapi-generator-cli": "^2.4.1",
"rimraf": "^3.0.2",
"typescript": "^4.4.2"
"typescript": "^5.4.5"
}
}
2 changes: 1 addition & 1 deletion typescript-fetch.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
inputSpec: "unofficial-documentation/src/openapi.yaml"
inputSpec: "unofficial-documentation/tsp-output/@typespec/openapi3/openapi.yaml"
generatorName: "typescript-fetch"
outputDir: "src"
validateSpec: false
Expand Down

0 comments on commit d81a857

Please sign in to comment.