if your micro controller are located remotely connected to internet I find it convenient to update firmware using the CI/CD approach. So today I wrote a gitlab-ci that upload firmware binary as soon as you push your code to gitlab remote.
in the above code you see I have PARTICLE_USR and PARTICLE_PWD which I have declared in Gitlab Project > Settings > CI/CD > Variables > [expand] and save the environment variables here. For PARTICLE_PWD i choose secret variable so it is not echoed.
yeah, still a clean solution to updates. i’m wondering though when and how you get rid of the .bin file.
would seem to me you would not want more than 1, the recently uploaded, in the directory. so should the now old [just flashed] .bin be moved to an archive or should it be deleted?
You may want to add the --saveTo switch to get a distinct file name and keep overwriting that each fresh build and use that same file name for the flash. This way you could keep an archive of binaries by just renaming them (although moving them into an archive directory would be wiser ) but won't flash the wrong one.
A more extensible approach would be to avoid logging into the particle cli and only use it for compilation (or use a local toolchain more directly)
Then, use a script to call the Particle Cloud API. This would allow you to actually upload your firmware to a product, unreleased. You could even have it upload the fw and release it to an “alpha” product group for testing once you create the pull request, and then have the firmware version simply released to product default when the PR is closed.
The advantage of the script and API combo is it gives you a lot more flexibility on exactly how you want to control your release process. You can still flash single devices directly, but the particle CLI doesn’t do as much with products as the API. Another advantage is using an API key which is cleaner to manage, especially in the context of a team of people.