Skip to content

GitHub Actions for ESP32 firmware OTA

To ship ESP32 firmware over-the-air (OTA) from GitHub Actions, build the application binary in the workflow (with PlatformIO, Arduino CLI or idf.py), then pass it to wassie-dev/simpleOTA-actions@v1. That action signs the binary if you give it a key, uploads it to SimpleOTA, which assigns the next build number, and starts a deployment to a release channel at the percentage you choose. Devices running the Arduino or ESP-IDF client pick it up on their next check. A complete PlatformIO workflow is below.

The actions handle the release, not the build. They need a binary that already exists in the runner, and the board must already run a SimpleOTA client from its first USB flash.

Action What it does
wassie-dev/simpleOTA-actions@v1 Sign, upload and deploy in one step.
wassie-dev/simpleOTA-actions/upload@v1 Sign and upload only. Returns an artifact id.
wassie-dev/simpleOTA-actions/deploy@v1 Create a deployment from an artifact id.
wassie-dev/simpleOTA-actions/promote@v1 Ramp, pause, resume, cancel or complete a deployment.

If you would rather not depend on a third-party action, the raw API calls are in Doing it by hand at the bottom of this page. The actions are a convenience wrapper over exactly those calls.

Credentials

Add these in Settings → Secrets and variables → Actions of your firmware repo.

Name Kind Value
SIMPLEOTA_TOKEN Secret An API-scoped project token. Issue one from the Project API tokens card on the project page.
SIMPLEOTA_SIGNING_KEY Secret Ed25519 private key PEM. Only for signed firmware.
SIMPLEOTA_PROJECT_ID Variable Your project UUID.

Project id is a variable, not a secret

A project id is not sensitive, and GitHub will happily let you add it in either tab. Add it as a secret by mistake and it still resolves through ${{ vars.SIMPLEOTA_PROJECT_ID }} as an empty string, which produces a malformed URL and a confusing 405 from the API. If you get a 405 on upload, check this first.

Your project id is shown next to the project name in the dashboard, with a copy button. You do not need to dig it out of the URL bar.

Ship on every merge

The simplest useful pipeline: build, then hand the binary to the release action. It signs (if you gave it a key), uploads, and creates a deployment.

name: release

on:
  push:
    branches: [main]

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      # ... your build steps, producing ./build/firmware.ino.bin ...

      - uses: wassie-dev/simpleOTA-actions@v1
        with:
          api-token:     ${{ secrets.SIMPLEOTA_TOKEN }}
          project-id:    ${{ vars.SIMPLEOTA_PROJECT_ID }}
          signing-key:   ${{ secrets.SIMPLEOTA_SIGNING_KEY }}
          key-id:        prod-2026
          binary:        build/firmware.ino.bin
          version-label: ${{ github.sha }}
          chip-family:   esp32

Upload the application image only. For Arduino CLI that is the plain <sketch>.ino.bin, not .merged.bin, .bootloader.bin or .partitions.bin: those contain the bootloader and partition table and will not fit the OTA app partition. See Firmware artifacts.

Set board-id only when your firmware sets cfg.board_id to the same value. An artifact with a board id is not offered to a device that reports none. See Compatibility.

PlatformIO project

This workflow builds a PlatformIO project when you push a version tag such as v1.4.0, then uploads the binary and starts a deployment to every device on the stable channel.

name: release

on:
  push:
    tags: ['v*']

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/cache@v4
        with:
          path: |
            ~/.cache/pip
            ~/.platformio/.cache
          key: pio-${{ runner.os }}-${{ hashFiles('platformio.ini') }}

      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'

      - name: Build
        run: |
          pip install --upgrade platformio
          pio run -e esp32dev

      - uses: wassie-dev/simpleOTA-actions@v1
        with:
          api-token:     ${{ secrets.SIMPLEOTA_TOKEN }}
          project-id:    ${{ vars.SIMPLEOTA_PROJECT_ID }}
          binary:        .pio/build/esp32dev/firmware.bin
          version-label: ${{ github.ref_name }}
          chip-family:   esp32

The matching platformio.ini pins the Arduino client:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps = https://github.com/wassie-dev/simpleOTAClient-Arduino.git#v1.0.0

.pio/build/<env>/firmware.bin is the application image. PlatformIO also writes bootloader.bin and partitions.bin next to it; do not upload those. Add signing-key and key-id to sign the build, as in Signed firmware.

To reach a slice of the channel first, set rollout-percentage and widen the deployment later with the promote action, using the deployment-id output. The dashboard's Ramp rollout panel appears only on canary deployments, so if you want to ramp from the dashboard, use the upload and deploy actions with rollout-strategy: canary as in Canary, then ramp.

Upload now, deploy after approval

Most teams do not want every merge reaching devices. Split the two steps and put a GitHub environment with a required reviewer between them: the artifact is uploaded and waiting, and a human decides when it ships.

jobs:
  build:
    runs-on: ubuntu-latest
    outputs:
      artifact-id: ${{ steps.upload.outputs.artifact-id }}
    steps:
      - uses: actions/checkout@v4
      # ... build ...
      - id: upload
        uses: wassie-dev/simpleOTA-actions/upload@v1
        with:
          api-token:     ${{ secrets.SIMPLEOTA_TOKEN }}
          project-id:    ${{ vars.SIMPLEOTA_PROJECT_ID }}
          signing-key:   ${{ secrets.SIMPLEOTA_SIGNING_KEY }}
          key-id:        prod-2026
          binary:        build/firmware.ino.bin
          version-label: ${{ github.sha }}
          chip-family:   esp32

  ship:
    needs: build
    runs-on: ubuntu-latest
    environment: production   # add a required reviewer here
    steps:
      - uses: wassie-dev/simpleOTA-actions/deploy@v1
        with:
          api-token:   ${{ secrets.SIMPLEOTA_TOKEN }}
          project-id:  ${{ vars.SIMPLEOTA_PROJECT_ID }}
          artifact-id: ${{ needs.build.outputs.artifact-id }}
          channel-ids: ${{ vars.SIMPLEOTA_STABLE_CHANNEL_ID }}

Canary, then ramp

Deploy to a small slice first, then widen it once the fleet looks healthy. The ramp is a separate, manually triggered workflow.

      - id: canary
        uses: wassie-dev/simpleOTA-actions/deploy@v1
        with:
          api-token:          ${{ secrets.SIMPLEOTA_TOKEN }}
          project-id:         ${{ vars.SIMPLEOTA_PROJECT_ID }}
          artifact-id:        ${{ needs.build.outputs.artifact-id }}
          channel-ids:        ${{ vars.SIMPLEOTA_STABLE_CHANNEL_ID }}
          rollout-strategy:   canary
          rollout-percentage: '5'

Later, against that deployment id:

      - uses: wassie-dev/simpleOTA-actions/promote@v1
        with:
          api-token:          ${{ secrets.SIMPLEOTA_TOKEN }}
          project-id:         ${{ vars.SIMPLEOTA_PROJECT_ID }}
          deployment-id:      ${{ inputs.deployment_id }}
          action:             ramp
          rollout-percentage: '50'

action also accepts start, pause, resume, cancel and complete. See Promoting deployments and Pausing deployments for what each one means for devices already checking in.

Signed firmware

Signing is not a separate step. Pass signing-key and key-id to the release or upload action and it signs the binary before upload, in the runner, then discards the key.

        with:
          signing-key: ${{ secrets.SIMPLEOTA_SIGNING_KEY }}
          key-id:      prod-2026

security-mode defaults to auto, which means signed when a key is present and basic when it is not. Set it explicitly to signed if you want the job to fail rather than silently upload an unsigned build when the secret is missing or empty.

The signature covers the final, shippable bytes. If your build also uses ESP32 Secure Boot, the SimpleOTA signature must be applied after espsecure appends its own block: see Secure Boot notes. The server verifies the signature at upload, so a wrong key or a stale signature fails the job with a clear error rather than bricking a fleet.

Strict mode

From v1.1.0, which @v1 tracks, a signed build released or uploaded by the actions is also made strict-ready, with nothing to add to the workflow. After the upload, the action signs the build number SimpleOTA assigned, together with the project, the key and the image's SHA-256, and attaches that strict signature. Devices in strict mode take only such builds, and devices in signed mode take them as before. The release action's deployment starts with the upload, so strict devices are offered the build once the strict signature is attached.

The SimpleOTA CLI makes the strict signature. The action installs the CLI release it pins (0.2.0 in v1.1.0), checked against pinned checksums, unless the cli-version input names another release. A simpleota already on the runner's PATH is used instead when there is one.

This step is best effort. If it fails, the upload and any deployment go ahead, and the job succeeds with a warning that names the build. The step summary then shows the build as not strict-ready, and strict devices are not offered it until you run simpleota build make-strict <build-number> <bin> with the build's binary. The raw API calls in Doing it by hand sign the image only, so their builds are not strict-ready.

Inputs and outputs

api-token and project-id are required by every action. Beyond those:

Action Also required Notable optional inputs Outputs
root (release) binary, version-label, chip-family framework (arduino), board-id, partition-profile, hardware-revision-min / -max, release-notes, signing-key, key-id, security-mode (auto), channel (stable), rollout-percentage (100), base-url build-number, artifact-id, deployment-id
upload binary, version-label, chip-family same as above, minus the deployment inputs build-number, artifact-id
deploy artifact-id rollout-strategy (immediate), rollout-percentage (100), channel-ids, group-ids, notes, start (true) deployment-id, state
promote deployment-id action (ramp), rollout-percentage state

channel-ids and group-ids take comma-separated UUIDs. The published deploy action requires at least one of them before it calls the API. On the server, groups are a union, channels are a union, and the two axes intersect. An empty axis is not a filter, so a deployment with neither list set includes every device in the project. Starting that audience for two or more devices requires confirm_all, which this action does not send. The root release action is different: it takes a channel name, defaulting to stable, and resolves it for you.

Fetch the UUIDs from the API once and store the one you want as a repository variable:

curl -s -H "Authorization: Bearer $SIMPLEOTA_TOKEN" \
  "https://simpleota.com/api/v1/projects/$SIMPLEOTA_PROJECT_ID/channels/" \
  | jq -r '.[] | "\(.name)\t\(.id)"'

base-url defaults to https://simpleota.com and only needs setting if you are pointed at a different instance.

Pinning

@v1 is a moving tag: it follows the latest backwards-compatible v1 release, so you pick up fixes without editing workflows. Pin a full tag (@v1.0.1) or a commit SHA if you would rather review every change yourself.

Doing it by hand

The actions are a wrapper. If you would rather not add the dependency, this is the same work as plain shell steps.

      - name: Sign firmware (Ed25519)
        env:
          SIMPLEOTA_SIGNING_KEY: ${{ secrets.SIMPLEOTA_SIGNING_KEY }}
        run: |
          set -euo pipefail
          printf '%s' "$SIMPLEOTA_SIGNING_KEY" > private.pem
          openssl pkeyutl -sign -inkey private.pem -rawin -in firmware.bin \
            | openssl base64 -A > firmware.sig.b64
          rm -f private.pem

      - name: Upload to SimpleOTA
        env:
          SIMPLEOTA_BASE_URL:   https://simpleota.com
          SIMPLEOTA_PROJECT_ID: ${{ vars.SIMPLEOTA_PROJECT_ID }}
          SIMPLEOTA_TOKEN:      ${{ secrets.SIMPLEOTA_TOKEN }}
          VERSION_LABEL:        ${{ github.ref_name }}
        run: |
          set -euo pipefail
          MANIFEST_JSON=$(jq -n \
            --arg version "$VERSION_LABEL" \
            --arg sig "$(cat firmware.sig.b64)" \
            '{
               framework: "arduino",
               version_label: $version,
               chip_family: "esp32",
               partition_profile: "default_4mb",
               nvs_schema_version: 1,
               security_mode: "signed",
               signing_metadata: {
                 key_id: "prod-2026",
                 algorithm: "ed25519",
                 signature: $sig
               }
             }')

          ARTIFACT_ID=$(curl --fail-with-body -s \
            -X POST "${SIMPLEOTA_BASE_URL}/api/v1/projects/${SIMPLEOTA_PROJECT_ID}/artifacts/" \
            -H "Authorization: Bearer ${SIMPLEOTA_TOKEN}" \
            -F "manifest=${MANIFEST_JSON}" \
            -F "binary=@firmware.bin" | jq -r .id)
          echo "ARTIFACT_ID=${ARTIFACT_ID}" >> "$GITHUB_ENV"

Drop signing_metadata and set security_mode to basic for an unsigned upload. Use jq rather than a heredoc to build the manifest: interpolating a version string straight into JSON breaks the moment it contains a quote.

Deploying takes two more calls. The first creates a deployment, in the draft state, for the artifact id from the upload response. The second starts it. CHANNEL_ID is the release channel to target, from the channels call under Inputs and outputs.

DEPLOYMENT_ID=$(curl --fail-with-body -s \
  -X POST "${SIMPLEOTA_BASE_URL}/api/v1/projects/${SIMPLEOTA_PROJECT_ID}/deployments/" \
  -H "Authorization: Bearer ${SIMPLEOTA_TOKEN}" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --arg a "$ARTIFACT_ID" --arg c "$CHANNEL_ID" \
        '{artifact_id: $a, target_channel_ids: [$c],
          rollout_strategy: "canary", rollout_percentage: 5}')" \
  | jq -r .id)

curl --fail-with-body \
  -X POST "${SIMPLEOTA_BASE_URL}/api/v1/projects/${SIMPLEOTA_PROJECT_ID}/deployments/${DEPLOYMENT_ID}/transition/" \
  -H "Authorization: Bearer ${SIMPLEOTA_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"action": "start"}'

Full request and response shapes are in the Developer API reference.