Skip to content

Inject API version at build from CHANGELOG - #317

Merged
unjica merged 1 commit into
developfrom
fix/auto-api-version-from-changelog
Jul 9, 2026
Merged

unjica merged 1 commit into
developfrom
fix/auto-api-version-from-changelog

Conversation

@unjica

@unjica unjica commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add apps/api/scripts/generate-api-version.cjs (mirrors telemetry-core inject-version pattern) to resolve the latest released semver from repo-root CHANGELOG.md, with fallbacks to git describe, committed api-version.ts, then dev.
  • GET /health version reads the build-time constant; TELEMETRY_API_VERSION remains an optional override only — no per-release Railway env required.
  • Docs updated (DEPLOYMENT.md, PRODUCTION-READINESS.md, .env.example).

Approach

Option A (build-time from CHANGELOG/git) — version is generated into apps/api/src/generated/api-version.ts on postinstall, build, and dev, then compiled into the API bundle. Railway clones the full monorepo (Root Directory apps/api still has ../../CHANGELOG.md); git-tag and committed-file fallbacks cover edge cases.

Test plan

  • pnpm lint && pnpm test && pnpm build
  • resolveApiVersion() unit tests
  • generate-api-version.cjs isolation tests (CHANGELOG parse + committed fallback)
  • After merge + deploy: GET /health shows 1.6.x without TELEMETRY_API_VERSION on Railway

Made with Cursor

Stop requiring TELEMETRY_API_VERSION on Railway each release; /health reads build-time semver with optional env override.

Co-authored-by: Cursor <[email protected]>
@unjica
unjica merged commit c717b29 into develop Jul 9, 2026
4 checks passed
@unjica
unjica deleted the fix/auto-api-version-from-changelog branch July 9, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant