-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create static.yml * static.yml完成 * README更新 * workflow_dispatchに変更
- Loading branch information
1 parent
178edd2
commit db7b7d1
Showing
2 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 '<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>API Documentation</title> | ||
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"></script> | ||
<style> | ||
body { margin: 0; } | ||
#redoc-container { padding: 20px; } | ||
</style> | ||
</head> | ||
<body> | ||
<div id="redoc-container"></div> | ||
<script> | ||
Redoc.init("openapi.json", {}, document.getElementById("redoc-container")); | ||
</script> | ||
</body> | ||
</html>' > 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 |
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