Skip to content

Commit 8c2a31a

Browse files
authored
Add permissions and OpenAPI spec generation steps to release workflow (#2)
* Add permissions and OpenAPI spec generation steps to release workflow * Add OpenAPI spec generation and conversion steps in CI workflows, rename the output file appropriately. * Show the generated openapi spec for user validation.
1 parent 6abb2ef commit 8c2a31a

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

.github/workflows/ci-build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ jobs:
6767
echo "Response: $response"
6868
exit 1
6969
fi
70+
71+
- name: Generate OpenAPI spec
72+
run: |
73+
# Download OpenAPI spec
74+
curl -s http://localhost:8000/openapi.json -o memoryalpha-rag-api-spec.json
75+
cat memoryalpha-rag-api-spec.json
7076
7177
- name: Cleanup
7278
if: always()

.github/workflows/pr-check.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ jobs:
5050
echo "Response: $response"
5151
exit 1
5252
fi
53+
54+
- name: Generate OpenAPI spec
55+
run: |
56+
# Download OpenAPI spec
57+
curl -s http://localhost:8000/openapi.json -o memoryalpha-rag-api-spec.json
58+
cat memoryalpha-rag-api-spec.json
5359
5460
- name: Cleanup
5561
if: always()

.github/workflows/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
release:
55
types: [published]
66

7+
permissions:
8+
contents: read
9+
packages: write
10+
711
jobs:
812
build-and-push:
913
runs-on: ubuntu-latest
@@ -48,3 +52,19 @@ jobs:
4852
repository: ${{ secrets.DOCKER_USERNAME }}/memoryalpha-rag-api
4953
short-description: "REST API for RAG over Star Trek MemoryAlpha database using Ollama"
5054
readme-filepath: ./README.md
55+
56+
- name: Generate OpenAPI spec
57+
run: |
58+
docker compose up -d lcars
59+
# Wait for API to be ready
60+
timeout 120 bash -c 'until curl -f http://localhost:8000/memoryalpha/health > /dev/null 2>&1; do sleep 5; echo "Waiting for API..."; done'
61+
# Download OpenAPI spec
62+
curl -s http://localhost:8000/openapi.json -o memoryalpha-rag-api-spec.json
63+
docker compose down -v
64+
65+
- name: Upload OpenAPI spec to release
66+
uses: softprops/action-gh-release@v2
67+
with:
68+
files: memoryalpha-rag-api-spec.json
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)