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: 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?
7 Replies
Solution
Bump on CI and get value on build
export const VERSION = “0.0.1”
Each push, bump by type (major.minor.patch)
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?
Vercel can’t do that on their own
You can try read the package json version thingy as well
You have actions for that
GitHub
Bump package version - GitHub Marketplace
Bumping package version depending on keywords present in the commit message
Most likely there will be a additional commit after pushing the version
If you also push directly from GitHub actions to vercel
gotcha, thanks!