I would like to build a GitHub Action to upload product firmware whenever a new release is pushed to github using the API endpoint. However, it looks like the difficult part will be supplying the version. When uploading via the web UI, it auto-fills this attribute in with the next available firmware version. Is there a way to bypass this? I suppose an alternative would be to first perform an API call and get the previous release version and then auto-increment? Any guidance would be appreciated!
Normally I’d think you could be checking this entry in the
However, I would have expected to see v1.5.2 but in that branch it’s currently v1.5.1
Just to clarify, you’re building your app using GitHub actions and you’d like it to automatically publish to the cloud when a release is created?
And you’re having trouble keeping track of
Yes, sorry for misspeaking. I meant the
PRODUCT_VERSION, not the firmware version, as that isn’t required to POST a new product firmware. So I would need: version, title, binary, productIdOrSlug, description, and mandatory. The binary shouldn’t be too difficult to identify, the productIdOrSlug can be set in env, and the title can be autogenerated. I think the version is the only one I’m not 100% sure about. Currently, my approach would be to first make an API call to
/v1/products/:productIdOrSlug/firmware and get the most recent version and +1 to it. Not sure if that will cause any major issues though…
In my experience (there are much more knowledgeable Particle cloud mechanics in here) it only matters that the
PRODUCT_VERSION increases, otherwise it won’ t update any devices with it.
– that is, devices will always prefer the firmware with the largest
Is there an issue with keeping a counter in the build system? As long as all your builds are released through Github, that should keep your counter consistent wouldn’t it?
Edit: Maybe I’m missing something that’s been added more recently, but don’t you need to know
PRODUCT_VERSION at compile time?