Deploy from github webhooks?

Ideally id like our to deploy from a tagged release in our github via webhooks. Has anyone managed this yet?

@jacobrosenthal, to confirm, do you mean that you would like a balena deployment to be triggered as a result of a tagged release being produced in GitHub?

The solution that comes to my mind is to set up a HTTP endpoint – a cloud server or a balena device using the public device URL feature – to receive the github webhook request and initiate the deployment to balenaCloud, using either ‘git push’ or the balena CLI (e.g. the ‘balena push’ or ‘balena deploy’ commands).

Thinking about it, you could use your specific IoT hardware device running balenaOS – like a Raspberry Pi or Intel NUC – instead of a cloud server, and the public device URL could be used as the webhook configuration in GitHub. You would still need to run a web server on the device, which would then run ‘git push’ or ‘balena build / deploy / push’. This is not necessarily better than using a cloud server, but it certainly has a “cool factor” to it. :slight_smile:

As the balena CLI is an open source Node.js app, there’s yet another possible solution which is to use “serverless” cloud services like AWS Lambda or Google Cloud Functions. It would mean a bit of fiddling to extract the relevant CLI source code, but should also be doable.

Some references:

It would be nice if balena could make this whole process easier… It’s something that we will consider!