Git push to flash firmware binary to particle devices


#1

if your micro controller are located remotely connected to internet I find it convenient to update firmware using the CI/CD approach. So today I wrote a gitlab-ci that upload firmware binary as soon as you push your code to gitlab remote.

stages:
  - flash

flash_binary:
  image: node:10
  stage: flash
  only:
  - master
  script:
  - apt-get update
  - apt-get -y install curl
  - curl -sL https://deb.nodesource.com/setup_10.x | bash -
  - apt-get install -y nodejs
  - npm install npm
  - npm install -g particle-cli
  - particle -q login -u $PARTICLE_USR -p  $PARTICLE_PWD
  - particle compile photon --target 0.7.0
  - particle flash <name_of_your_particle_device> *.bin

in the above code you see I have PARTICLE_USR and PARTICLE_PWD which I have declared in Gitlab Project > Settings > CI/CD > Variables > [expand] and save the environment variables here. For PARTICLE_PWD i choose secret variable so it is not echoed.


#2

thanks, had not seen this before. i guess a next probable step is for you to apply for a job at particle. :slight_smile: