From db7b7d15d5a9f76f60d4dc3092df39df248bce35 Mon Sep 17 00:00:00 2001 From: NOZAKI Shuntaro <60352276+shun-harutaro@users.noreply.github.com> Date: Sun, 18 Aug 2024 21:20:31 +0900 Subject: [PATCH] =?UTF-8?q?redoc=E3=81=A7API=20doc=20=E3=82=92=E4=BD=9C?= =?UTF-8?q?=E6=88=90=E3=81=97=E3=81=9F=20(#88)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Create static.yml * static.yml完成 * README更新 * workflow_dispatchに変更 --- .github/workflows/static.yml | 77 ++++++++++++++++++++++++++++++++++++ README.md | 4 +- 2 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/static.yml diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml new file mode 100644 index 0000000..e90f846 --- /dev/null +++ b/.github/workflows/static.yml @@ -0,0 +1,77 @@ +name: Deploy API doc to Pages + +on: + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Create .env file + run: | + touch .env + echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> .env + echo "VOICEVOX_API_KEY=${{ secrets.VOICEVOX_API_KEY }}" >> .env + - name: Run docker-compose Build + run: | + docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build -d + sleep 5 + curl http://localhost + + - name: Wait for the API to be ready + run: | + for i in {1..60}; do + curl -s http://localhost/openapi.json && break + echo "Waiting for API to be ready..." + sleep 2 + done + + - name: Download OpenAPI Specification + run: | + curl -o openapi.json http://localhost/openapi.json + - name: Generate Redoc HTML + run: | + mkdir -p docs + cp openapi.json docs/ + echo ' + + + API Documentation + + + + +
+ + + ' > docs/index.html + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: 'docs/' + retention-days: 7 + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/README.md b/README.md index 12ccbdb..a8cbae0 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ touch .env echo "VOICEVOX_API_KEY=[voicevox api key]" >> .env echo "OPENAI_API_KEY=[openAI api key]" >> .env ``` -`VOICEVOX_API_KEY` は https://su-shiki.com/api/ から、 +`VOICEVOX_API_KEY` は https://su-shiki.com/api/ から、 `OPENAI_API_KEY` は https://platform.openai.com/docs/overview から取得します 3. Dockerイメージのビルド @@ -57,7 +57,7 @@ sudo make stop ``` ## APIエンドポイント(v1) -詳しくは http://localhost/docs を参照してください。 +詳しくは https://futaringoto.github.io/futarin-api/ を参照してください。 | メソッド | パス | 概要 | | :----- | :-- | :-- | | POST | `/v1/raspi` | 一連の処理全て |