2023-03-15 13:10:53 +00:00
|
|
|
name: OpenAPI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2023-06-12 09:34:44 +00:00
|
|
|
- 'master'
|
2023-03-15 13:10:53 +00:00
|
|
|
paths:
|
|
|
|
- 'openapi.yaml'
|
|
|
|
- '.github/workflows/docs.yml'
|
2023-03-23 11:19:33 +00:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- '**'
|
|
|
|
paths:
|
|
|
|
- 'openapi.yaml'
|
|
|
|
- '.github/workflows/docs.yml'
|
2023-03-15 13:10:53 +00:00
|
|
|
|
|
|
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
pages: write
|
|
|
|
id-token: write
|
|
|
|
|
|
|
|
jobs:
|
2023-03-23 11:19:33 +00:00
|
|
|
lint:
|
|
|
|
name: Lint
|
2023-03-15 13:10:53 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-01-29 15:21:52 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-03-15 13:10:53 +00:00
|
|
|
with:
|
2024-10-28 13:53:41 +00:00
|
|
|
fetch-depth: 0
|
2023-03-15 13:10:53 +00:00
|
|
|
|
2024-01-29 15:21:52 +00:00
|
|
|
- uses: actions/setup-node@v4
|
2023-03-15 13:10:53 +00:00
|
|
|
with:
|
|
|
|
node-version: 18
|
|
|
|
|
|
|
|
- name: Lint OpenAPI
|
|
|
|
run: npx @redocly/cli lint openapi.yaml
|
|
|
|
|
2023-03-23 11:19:33 +00:00
|
|
|
deploy:
|
|
|
|
name: Deploy
|
|
|
|
runs-on: ubuntu-latest
|
2023-06-12 09:34:44 +00:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2023-03-23 11:19:33 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-01-29 15:21:52 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-03-23 11:19:33 +00:00
|
|
|
with:
|
2024-10-28 13:53:41 +00:00
|
|
|
fetch-depth: 0
|
2023-03-23 11:19:33 +00:00
|
|
|
|
2024-01-29 15:21:52 +00:00
|
|
|
- uses: actions/setup-node@v4
|
2023-03-23 11:19:33 +00:00
|
|
|
with:
|
|
|
|
node-version: 18
|
|
|
|
|
2023-03-15 13:10:53 +00:00
|
|
|
- name: Build OpenAPI
|
2024-10-28 13:53:41 +00:00
|
|
|
run: npx @redocly/cli build-docs openapi.yaml --output openapi/index.html --title "Codex API"
|
|
|
|
|
|
|
|
- name: Build Postman Collection
|
|
|
|
run: npx -y openapi-to-postmanv2 -s openapi.yaml -o openapi/postman.json -p -O folderStrategy=Tags,includeAuthInfoInExample=false
|
2023-03-15 13:10:53 +00:00
|
|
|
|
|
|
|
- name: Upload artifact
|
2024-01-29 15:21:52 +00:00
|
|
|
uses: actions/upload-pages-artifact@v3
|
2023-03-15 13:10:53 +00:00
|
|
|
with:
|
2024-10-28 13:53:41 +00:00
|
|
|
path: openapi
|
2023-03-15 13:10:53 +00:00
|
|
|
|
|
|
|
- name: Deploy to GitHub Pages
|
2024-01-29 15:21:52 +00:00
|
|
|
uses: actions/deploy-pages@v4
|