From 89e2b802aa3affd723e37bab7da9144414dd70be Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Thu, 18 Jul 2019 02:04:14 +0200 Subject: [PATCH] deploy --- .gitlab-ci.yml | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 42700c8..62c68c0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,14 +1,13 @@ -image: python:2.7 - stages: - build + - deploy -before_script: - - pip install -U platformio - - platformio update - -job: +build: stage: build + image: python:2.7 + before_script: + - pip install -U platformio + - platformio update script: - platformio ci --project-conf platformio.ini --board=lolin_d32_pro # - cp ~/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader_dio_40m.bin .pioenvs/lolin_d32_pro/ @@ -17,3 +16,21 @@ job: artifacts: paths: - ".pio/build/lolin_d32_pro/*.bin" + +deploy: + stage: deploy + image: alpine:latest + before_script: + - apk update && apk add openssh-client bash rsync +# - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + - eval $(ssh-agent -s) + - echo "${SSH_PRIVATE_KEY}" | tr -d '\r' | ssh-add - > /dev/null + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo "${SSH_HOST_KEY}" > ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + script: + - scp .pio/build/lolin_d32_pro/firmware.bin "${SSH_USER_HOST}:${DEPLOY_PATH}" + when: manual + only: + - master