Best practices for rendering the version of your app

I have a React-TypeScript web app in which I'd like to render the current version at the top of the home page. What I'm thinking is that I could have a version.ts file with this:
export const APP_VERSION = "1.0.0"
export const APP_VERSION = "1.0.0"
and then when I make a commit, I increase that number. But I've never seen this being done in real world open source github projects. What's the best approach here?
Solution:
Bump on CI and get value on build
Jump to solution
7 Replies
Solution
Neto
Neto2mo ago
Bump on CI and get value on build
Neto
Neto2mo ago
export const VERSION = “0.0.1” Each push, bump by type (major.minor.patch)
Muhct
Muhct2mo ago
you mean I should set up a Github CI/CD pipeline? Or can Vercel handle this by its own? and the CI would change the value of the VERSION const without "dirtying" the commit history?
Neto
Neto2mo ago
Vercel can’t do that on their own You can try read the package json version thingy as well You have actions for that
Neto
Neto2mo ago
GitHub
Bump package version - GitHub Marketplace
Bumping package version depending on keywords present in the commit message
Neto
Neto2mo ago
Most likely there will be a additional commit after pushing the version If you also push directly from GitHub actions to vercel
Muhct
Muhct2mo ago
gotcha, thanks!