diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 6e925fc..4dd3aec 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -67,6 +67,12 @@ jobs: echo "Response: $response" exit 1 fi + + - name: Generate OpenAPI spec + run: | + # Download OpenAPI spec + curl -s http://localhost:8000/openapi.json -o memoryalpha-rag-api-spec.json + cat memoryalpha-rag-api-spec.json - name: Cleanup if: always() diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 96e12f2..c42a0b0 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -50,6 +50,12 @@ jobs: echo "Response: $response" exit 1 fi + + - name: Generate OpenAPI spec + run: | + # Download OpenAPI spec + curl -s http://localhost:8000/openapi.json -o memoryalpha-rag-api-spec.json + cat memoryalpha-rag-api-spec.json - name: Cleanup if: always() diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 493e7d8..e9057aa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,10 @@ on: release: types: [published] +permissions: + contents: read + packages: write + jobs: build-and-push: runs-on: ubuntu-latest @@ -48,3 +52,19 @@ jobs: repository: ${{ secrets.DOCKER_USERNAME }}/memoryalpha-rag-api short-description: "REST API for RAG over Star Trek MemoryAlpha database using Ollama" readme-filepath: ./README.md + + - name: Generate OpenAPI spec + run: | + docker compose up -d lcars + # Wait for API to be ready + timeout 120 bash -c 'until curl -f http://localhost:8000/memoryalpha/health > /dev/null 2>&1; do sleep 5; echo "Waiting for API..."; done' + # Download OpenAPI spec + curl -s http://localhost:8000/openapi.json -o memoryalpha-rag-api-spec.json + docker compose down -v + + - name: Upload OpenAPI spec to release + uses: softprops/action-gh-release@v2 + with: + files: memoryalpha-rag-api-spec.json + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file