Feat/add GitHub workflow for api docs #5
This file contains 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: Publish Api Docs to GitHub Pages | |
on: | |
pull_request: | |
branches: [dev, main] | |
jobs: | |
publish-api-docs: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8.0.39 | |
env: | |
MYSQL_ROOT_PASSWORD: userfeedback | |
MYSQL_DATABASE: userfeedback | |
MYSQL_USER: userfeedback | |
MYSQL_PASSWORD: userfeedback | |
TZ: UTC | |
ports: | |
- 13306:3306 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Build app and swagger docs | |
run: | | |
npx corepack enable | |
pnpm install --frozen-lockfile | |
pnpm build | |
cd apps/api | |
mkdir docs | |
cp .env.example .env | |
npm install -g ts-node | |
npx ts-node -r tsconfig-paths/register src/scripts/build-swagger-docs.ts | |
- name: Redocly CLI Test | |
uses: fluximus-prime/redocly-cli-github-action@v1 | |
with: | |
args: "build-docs apps/api/swagger.json --output docs/docs.html" | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs |