I have a quarkus cli application I compile native. Now I want to implement a self-update feature. That is, the cli application should be capable of updating itself with the newest compiled version. What would be a good approach to realize this?
1 Reply
To my best knowledge
On startup, call a function to check the latest version from GitHub or a URL where version info is served.
Example: https://api.github.com/repos/ozkanpakdil/swaggerific/releases/latestIf there’s a new version, ask the user to update (Y/n).
If user hit Y, download the zip and overwrite the current install.
- If it’s a native exe, overwriting may fail (especially on Windows).
- In that case, trigger a bash script to handle download + overwrite.
Be careful about the path the CLI needs correct access to write there.
Restart the CLI with the same parameters so it continues what the user requested.
- CLI updated itself, user request runs, happy end.
I saw this flow in 2009 in a windows application. If you have MSI to deliver this may change but steps will be similar. Here there are many different examples.