build(deploy): refresh OpenAPI docs after deployments - #1540
build(deploy): refresh OpenAPI docs after deployments#1540NishaSharma14 wants to merge 2 commits into
Conversation
Regenerate L5 Swagger docs and publish public/api-docs.json as part of the shared post-deploy routine for both dev and prod deployments, so API docs stay in sync with deployed code after build, restart, or successful image deploy.
There was a problem hiding this comment.
🟡 Changes recommended
OpenAPI regeneration is currently likely to run multiple times per deploy invocation (and one prod log message is misleading), which should be addressed before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the deployment scripts to regenerate L5 Swagger OpenAPI docs post-deploy so the published public/api-docs.json stays aligned with the currently deployed code.
Changes:
- Added a
refresh_openapi_docsroutine to runphp artisan l5-swagger:generateand copy the generated spec intopublic/api-docs.json. - Wired OpenAPI refresh into the shared post-deploy routine (
run_migration_and_clear_cache) for both dev and prod scripts.
File summaries
| File | Description |
|---|---|
| deployment/deploy-prod.sh | Adds OpenAPI doc refresh and runs it during the migration/cache routine for prod deploy/build/restart flows. |
| deployment/deploy-dev.sh | Adds OpenAPI doc refresh and runs it during the migration/cache routine for dev deploy/build/restart flows. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| refresh_openapi_docs() { | ||
| log_message "Refreshing OpenAPI documentation..." | ||
|
|
||
| docker compose -f "$COMPOSE_FILE" exec -T app sh -lc 'cd /var/www/html && L5_SWAGGER_USE_REFLECTION_ANALYSER=true php artisan l5-swagger:generate && cp storage/api-docs/api-docs.json public/api-docs.json' | ||
|
|
||
| log_message "OpenAPI documentation refreshed successfully" | ||
| } |
| refresh_openapi_docs() { | ||
| log_message "Refreshing OpenAPI documentation..." | ||
|
|
||
| docker compose -f "$COMPOSE_FILE" exec -T app sh -lc 'cd /var/www/html && L5_SWAGGER_USE_REFLECTION_ANALYSER=true php artisan l5-swagger:generate && cp storage/api-docs/api-docs.json public/api-docs.json' | ||
|
|
||
| log_message "OpenAPI documentation refreshed successfully" | ||
| } |
| docker compose -f "$COMPOSE_FILE" exec -T app php artisan optimize:clear | ||
|
|
||
| log_message "Database migration completed successfully" | ||
| log_message "Database migration and cache refresh completed successfully" |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## development #1540 +/- ##
==============================================
Coverage 80.25% 80.26%
Complexity 4481 4481
==============================================
Files 293 293
Lines 16424 16424
==============================================
+ Hits 13181 13182 +1
+ Misses 3243 3242 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Regenerate L5 Swagger docs and publish public/api-docs.json as part of the shared post-deploy routine for both dev and prod deployments, so API docs stay in sync with deployed code after build, restart, or successful image deploy.