Skip to content

GitHub Actions ​

The ConnectMQ MQTT Publish action sends an MQTT message from any GitHub workflow, for example "deployment finished" to a dashboard or a command to a device fleet.

Set up the secrets ​

In your repository, Settings → Secrets and variables → Actions → New repository secret:

SecretValue
MQTT_USERNAMEUsername from MQTT Connection Settings
MQTT_PASSWORDPassword
MQTT_CLIENT_IDIssued client ID

TIP

Create a dedicated credential set for CI with Add credentials, so you can revoke it without affecting devices.

Workflow ​

yaml
name: Notify devices
on:
  push:
    branches: [main]

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: connectmq/connectmq-mqtt-publish@v1
        with:
          username: ${{ secrets.MQTT_USERNAME }}
          password: ${{ secrets.MQTT_PASSWORD }}
          client-id: ${{ secrets.MQTT_CLIENT_ID }}
          topic: myproject/ci/deploy
          message: '{"status":"deployed","sha":"${{ github.sha }}"}'

Defaults ​

InputDefault
hostbroker.connectmq.com
protocol / portmqtts / 8883 (also mqtt 1883, ws 8083, wss 8084)
mqtt-version5
qos1
retainfalse
client-id-suffixtrue: appends _gha-<run id>-<random> so parallel jobs never share a client ID

Each run opens a short connection that counts towards your concurrent connections and session minutes. Full reference: action README.

Fully managed MQTT broker for connected devices.