diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 68633dacd37c9714e26a8b643d0e21b5bebda748..b45811d385894e309e56eca7b32ae06296b3b8e5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ build: script: # Set up Arduino environment - cat /etc/os-release - - apt-get install -y wget python3-pip + - apt-get install -y wget python3-pip rename - wget -nv https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_64bit.tar.gz - tar -xf arduino-cli_latest_Linux_64bit.tar.gz @@ -29,12 +29,18 @@ build: - arduino-cli lib install Ethernet - arduino-cli lib install --git-url https://github.com/patricklaf/SNMP.git --config-file arduino-cli.yaml + # Set version, tag if available else commit sha + - ICBM_GIT_VERSION=$CI_COMMIT_SHORT_SHA + - if [[ -v CI_COMMIT_TAG ]]; then ICBM_GIT_VERSION=$CI_COMMIT_TAG; fi; + - echo "Firmware version is $ICBM_GIT_VERSION" + # Compile artifact - - arduino-cli compile --fqbn esp32:esp32:esp32wroverkit icbm.ino --output-dir firmware --build-property build.extra_flags="-DICBM_GIT_VERSION=\"$CI_COMMIT_SHORT_SHA\" -DICBM_GIT_TIMESTAMP=\"$CI_COMMIT_TIMESTAMP\"" - - zip -r firmware.zip firmware + - arduino-cli compile --fqbn esp32:esp32:esp32wroverkit icbm.ino --output-dir icbm-$ICBM_GIT_VERSION --build-property build.extra_flags="-DICBM_GIT_VERSION=\"$ICBM_GIT_VERSION\" -DICBM_GIT_TIMESTAMP=\"$CI_COMMIT_TIMESTAMP\"" + - rename "s/ino/$ICBM_GIT_VERSION/" icbm-$ICBM_GIT_VERSION/* + - zip -r icbm-$ICBM_GIT_VERSION.zip icbm-$ICBM_GIT_VERSION artifacts: when: always paths: - - firmware.zip + - icbm-*.zip expire_in: 1 week interruptible: true