Merge pull request #42 from NYCU-SDC/feat/CORE-174-implement-error-re… #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy API docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| name: Deploy API docs | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: | | |
| pnpm build | |
| - name: Generate Redocly and Swagger UI | |
| run: | | |
| npm i -g @redocly/cli@latest | |
| redocly build-docs tsp-output/schema/openapi.1.0.0.yaml --output redocly.html | |
| - name: Move files | |
| run: | | |
| mkdir -p publish/tsp-output/schema | |
| mv tsp-output/schema/openapi.1.0.0.yaml publish/tsp-output/schema/openapi.1.0.0.yaml | |
| mv index.html publish/index.html | |
| mv swagger.html publish/swagger.html | |
| mkdir -p publish/redocly | |
| mv redocly.html publish/redocly/index.html | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./publish |