{"id":16398066,"url":"https://github.com/becem-gharbi/esp-ota-cicd","last_synced_at":"2025-03-23T05:30:57.547Z","repository":{"id":170105806,"uuid":"645746681","full_name":"becem-gharbi/esp-ota-cicd","owner":"becem-gharbi","description":"A complete CI/CD solution for ESP32","archived":false,"fork":false,"pushed_at":"2024-07-25T05:16:28.000Z","size":53,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T22:24:30.638Z","etag":null,"topics":["ci-cd","esp32","github","ota"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/becem-gharbi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-26T10:45:51.000Z","updated_at":"2024-12-21T12:54:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"0d1d17ab-2bde-402d-8910-ec2ff4539c97","html_url":"https://github.com/becem-gharbi/esp-ota-cicd","commit_stats":null,"previous_names":["becem-gharbi/esp-ota-cicd"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becem-gharbi%2Fesp-ota-cicd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becem-gharbi%2Fesp-ota-cicd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becem-gharbi%2Fesp-ota-cicd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becem-gharbi%2Fesp-ota-cicd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/becem-gharbi","download_url":"https://codeload.github.com/becem-gharbi/esp-ota-cicd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244275434,"owners_count":20427298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci-cd","esp32","github","ota"],"created_at":"2024-10-11T05:11:45.845Z","updated_at":"2025-03-23T05:30:57.208Z","avatar_url":"https://github.com/becem-gharbi.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ESP OTA CI/CD\n\n\u003e [!TIP]\n\u003e To visually apply the OTA update, it's recommended to use [ESP Admin](https://esp-admin.tn/) which is a web platform for remote management of ESP32 microcontrollers.\n\nThis project provides a CI/CD pipeline for seamless remote software updates to *ESP32*, including a PlatformIO library that automatically handles deployment.\n\n## Requirements\n\n- Platform `espressif32`\n- IDE `PlatformIO`\n- Framework `Arduino`\n\n## How it works\n\n- Upon a new software release, depending on the CI/CD tool used, a workflow is triggered.\n\n- The code is compiled to generate the executable binary.\n\n- The executable is uploaded to an S3-compatible bucket.\n\n- An MQTT message is sent to the release topic on which `ESP32` is subscribed. The message contains the firmware version and the download URL.\n\n- The library receives the message and checks the version against the running version.\n\n- If the received firmware is newer, the library downloads it and performs the necessary flashing process.\n\n## CI/CD settings\n\nThe settings depend on the CI/CD tool used. An integration with `Github Actions` is provided via `.github/workflows/release.yml`.\nThe variables and secrets **should** be set as described in [docs](https://docs.github.com/en/actions/learn-github-actions/variables).\n\n### Secrets\n\n| **Secrets**          | **Notes**                                                                          |\n| -------------------- | ---------------------------------------------------------------------------------- |\n| MQTT_HOST            | The MQTT host, eg `broker.hivemq.com`                                              |\n| MQTT_PORT            | The MQTT TCP port, eg `1883`                                                       |\n| MQTT_SECURE          | Whether a default SSL configuration is used, can be set to `false` or ` ` for true |\n| MQTT_VERSION         | The MQTT version can be set to `3` or `5`                                          |\n| MQTT_USER            | The username for MQTT authentication                                               |\n| MQTT_PASSWORD        | The password for MQTT authentication                                               |\n| S3_ACCESS_KEY_ID     | The S3 client ID                                                                   |\n| S3_SECRET_ACCESS_KEY | The S3 client secret                                                               |\n| S3_ENDPOINT_URL      | The S3 endpoint, check provider                                                    |\n| S3_REGION            | The S3 region, check provider                                                      |\n| S3_BUCKET            | The S3 bucket used, should be public                                               |\n| S3_PUBLIC_URL        | The public URL of the provided bucket                                              |\n\n### Variables\n\n| **Variables**  | **Notes**                                                     |\n| -------------- | ------------------------------------------------------------- |\n| MQTT_PUB_TOPIC | The MQTT topic to which the release message will be published |\n| PIO_ENV        | Environment to build, check `platformio.ini`                  |\n\n## Library usage\n\nTo automatically deploy the new firmware, this project provides a PlatformIO library\n\n```\npio pkg install --library \"bg-dev/OtaCicd\"\n```\n\nThe library exposes `OtaCicd` class which implements an MQTT client and an OTA handler with secure HTTP connections. You just need to initialize it\n\n```C++\nesp_mqtt_client_config_t mqttConfig = {\n    .uri = mqtt_uri,\n    .client_id = mqtt_client_id,\n    .username = mqtt_user,\n    .password = mqtt_password,\n    .cert_pem = mqtt_cert_pem};\n\nOtaCicd::init(s3CertPem, releaseTopic, mqttConfig);\n```\n\nIn case you want to implement an MQTT client independently, you can call the `start` method upon receiving a release message.\n\n```C++\nOtaCicd::init(s3CertPem);\n\nOtaCicd::start(message);\n```\n\n## License\n\n[MIT License](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbecem-gharbi%2Fesp-ota-cicd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbecem-gharbi%2Fesp-ota-cicd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbecem-gharbi%2Fesp-ota-cicd/lists"}