Skip to content

🎉 🐍 Get URL of the latest firmware release binary from GitHub API

Notifications You must be signed in to change notification settings

kaizoku-oh/github-ota-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Github OTA API

GitHub release GitHub issues GitHub top language Flask version License: MIT

Serving binary release asset from GitHub to devices.

Twitter follow

github-ota-api

Base URL: https://github-ota-api.herokuapp.com

Endpoint: /firmware/latest

Request example:

GET http://github-ota-api.herokuapp.com/firmware/latest?github_username=kaizoku-oh&github_repository=pio-freertos&device_current_fw_version=1.4.0

Response example:

{
  "download_url": "https://github-production-release-asset-2e65be.s3.amazonaws.com/208622543/e4888800-96c8-11ea-9a9e-5c47f103310b?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200725%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200725T153508Z&X-Amz-Expires=300&X-Amz-Signature=be26eaa701d4dbe47cca57e8a01e31a2f36d045beaef3a0c1311bde8e1fd94d5&X-Amz-SignedHeaders=host&actor_id=0&repo_id=208622543&response-content-disposition=attachment%3B%20filename%3Dfirmware.bin&response-content-type=application%2Foctet-stream",
  "version": "1.7.0"
}

Development notes:

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

# install dependencies
$ sudo apt install python3-pip
$ python3 -m pip install --upgrade pip
$ python3 -m pip --version
$ python3 -m pip install pipenv
# get project
$ git clone https://github.com/kaizoku-oh/github-ota-api.git
$ cd github-ota-api
# create a virtualenv for the project
$ python3 -m pipenv install
# activate project's virtualenv
$ python3 -m pipenv shell
$ cd app
$ python3 main.py

Deployment notes:

It's recommended to keep your github repo changes aligned with the heroku repo by following these steps.

1. Push code to GitHub

$ git clone https://github.com/kaizoku-oh/github-ota-api
$ cd github-ota-api
$ git checkout dev
# make your changes to the code
$ git add .
$ git commit -m "your commit message here"
$ git push origin dev
# Go to Github, open a pull request and merge merge changes
$ git checkout master
$ git pull

2. Push code to Heroku

$ heroku login
# Add a heroku remote to your local repository
$ heroku git:remote -a github-ota-api
$ git push heroku master