Skip to main content

GitLab CI/CD

Automatically upload your build artifacts (binaries, hex files, map files, etc.) to EmbedHub projects directly from your GitLab CI/CD pipelines.

This is the GitLab equivalent of the GitHub Action — a reusable CI/CD component that runs the EmbedHub CLI's push command as a job.

Features

  • Upload firmware binaries, hex files, map files, and other build artifacts
  • Support for glob patterns to upload multiple files

Quick Start

1. Create an EmbedHub API Key

  1. Log in to your EmbedHub account
  2. Go to your settings
  3. Navigate to the "API Keys" tab
  4. Create a new API key and copy it

2. Add a CI/CD Variable

Add your API key as a masked CI/CD variable:

  • Go to Settings → CI/CD → Variables → Add variable
  • Key: EMBEDHUB_API_KEY
  • Value: your EmbedHub API key
  • Tick Mask variable (and Protect variable if you only deploy from protected branches/tags)
note

The API key is read from the EMBEDHUB_API_KEY variable, not passed as a component input — inputs are not secret.

3. Use in Your Pipeline

Add the component to your .gitlab-ci.yml after your build job:

include:
- component: $CI_SERVER_FQDN/embedhub/gitlab-ci/upload@main
inputs:
organization: mycompany
project: my-firmware
files: build/*.bin

This generates a job named embedhub-upload in the deploy stage.

Usage Examples

Upload Firmware Binary

include:
- component: $CI_SERVER_FQDN/embedhub/gitlab-ci/upload@main
inputs:
organization: mycompany
project: iot-device
files: firmware.bin

Upload Multiple Files with Glob Pattern

include:
- component: $CI_SERVER_FQDN/embedhub/gitlab-ci/upload@main
inputs:
organization: mycompany
project: embedded-app
files: build/*.{bin,hex,map,elf}

Upload to Specific Path

include:
- component: $CI_SERVER_FQDN/embedhub/gitlab-ci/upload@main
inputs:
organization: mycompany
project: sensor-firmware
files: dist/*.bin
path: releases/$CI_COMMIT_TAG/

Upload from Subdirectory

include:
- component: $CI_SERVER_FQDN/embedhub/gitlab-ci/upload@main
inputs:
organization: mycompany
project: motor-controller
files: '*.hex'
working_directory: ./build/output

Run Only on Tags

The job runs in whatever pipeline includes it. To restrict the pipeline to tags, add a workflow rule:

workflow:
rules:
- if: $CI_COMMIT_TAG

include:
- component: $CI_SERVER_FQDN/embedhub/gitlab-ci/upload@main
inputs:
organization: mycompany
project: sensor-firmware
files: dist/*.bin
path: releases/$CI_COMMIT_TAG/

Inputs

InputRequiredDescriptionDefault
organizationYesOrganization slug (e.g. mycompany or username)-
projectYesProject slug (e.g. my-firmware)-
filesYesFiles to upload (supports glob: *.bin, build/*.{hex,map})-
pathNoTarget path in project (e.g. releases/$CI_COMMIT_TAG/)Auto-detected
working_directoryNoDirectory to run the upload from.
stageNoPipeline stage for the jobdeploy
job_nameNoName of the generated jobembedhub-upload
imageNoImage the job runs in (needs curl + bash, or apt/apk)debian:bookworm-slim
cli_urlNoURL to download the EmbedHub CLI (linux-amd64)CDN default

The API key is supplied via the EMBEDHUB_API_KEY CI/CD variable, not an input.

Default File Paths

When path is not specified, files are uploaded to these default locations based on file type:

File TypeExtensionsDefault Path
Release Files.bin, .hex, .elf, .mapreleases/
Images.jpg, .png, .svg, .webp, .gif, .mp4, .mov, .webmphotos/
Documents.pdfdocuments/
Other FilesAll othersRoot directory