From d828cdbed69b4183ed6ba03e82a03545274d2bcb Mon Sep 17 00:00:00 2001 From: aniongithub Date: Thu, 7 Aug 2025 10:42:18 -0700 Subject: [PATCH 1/3] Add permissions and OpenAPI spec generation steps to release workflow --- .github/workflows/release.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 493e7d8..12a2619 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 openapi.json + docker compose down -v + + - name: Upload OpenAPI spec to release + uses: softprops/action-gh-release@v2 + with: + files: openapi.json + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From d041e3480fb81d98a9949f56be76e2c45a6bb171 Mon Sep 17 00:00:00 2001 From: aniongithub Date: Thu, 7 Aug 2025 10:55:38 -0700 Subject: [PATCH 2/3] Add OpenAPI spec generation and conversion steps in CI workflows, rename the output file appropriately. --- .github/workflows/ci-build.yml | 5 +++++ .github/workflows/pr-check.yml | 5 +++++ .github/workflows/release.yml | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 6e925fc..cca88f4 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -67,6 +67,11 @@ 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 - name: Cleanup if: always() diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 96e12f2..ecb720e 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -50,6 +50,11 @@ 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 - name: Cleanup if: always() diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12a2619..e9057aa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -59,12 +59,12 @@ jobs: # 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 openapi.json + 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: openapi.json + files: memoryalpha-rag-api-spec.json env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From b3a09f6c26dbc59e1ad535d163eba0722e96d6a4 Mon Sep 17 00:00:00 2001 From: aniongithub Date: Thu, 7 Aug 2025 11:01:14 -0700 Subject: [PATCH 3/3] Show the generated openapi spec for user validation. --- .github/workflows/ci-build.yml | 1 + .github/workflows/pr-check.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index cca88f4..4dd3aec 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -72,6 +72,7 @@ jobs: 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 ecb720e..c42a0b0 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -55,6 +55,7 @@ jobs: 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()