Git push to flash firmware binary to particle devices


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.

  - flash

  image: node:10
  stage: flash
  - master
  - apt-get update
  - apt-get -y install curl
  - curl -sL | 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.


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