From 996795a49a2e5f258069eeb7c884df6e4f26c753 Mon Sep 17 00:00:00 2001 From: kleph Date: Tue, 27 Oct 2020 17:46:45 +0100 Subject: [PATCH 1/4] [CI] Add deploy live stage and factorize dpeloy commands --- .drone.yml | 58 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/.drone.yml b/.drone.yml index d9e8eda..25b3646 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,6 +1,6 @@ --- kind: pipeline -name: lint +name: build steps: - name: markdown lint @@ -13,6 +13,19 @@ steps: commands: - pelican content -o output -s pelicanconf.py + +--- +deploy_commands: +- &deploy_commands + commands: + - echo "deploy $DEPLOY_USER@$DEPLOY_HOST" + - echo "$DEPLOY_KEY" | sed 's/!/\n/g' > deploy_key + - chmod 0600 deploy_key + - ssh -i deploy_key -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_HOST rm -Rf ${DEPLOY_DIR}/output/ + - scp -r -i deploy_key -o StrictHostKeyChecking=no output $DEPLOY_USER@$DEPLOY_HOST:${DEPLOY_DIR} + +kind: pipeline +name: deploy - name: deploy staging image: kroniak/ssh-client environment: @@ -22,33 +35,26 @@ steps: from_secret: deploy_host DEPLOY_KEY: from_secret: deploy_key - commands: - - echo "deploy $DEPLOY_USER@$DEPLOY_HOST" - - echo "$DEPLOY_KEY" | sed 's/!/\n/g' > deploy_key - - chmod 0600 deploy_key - - ssh -i deploy_key -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_HOST rm -Rf /srv/http/blog-lan/output/ - - scp -r -i deploy_key -o StrictHostKeyChecking=no output $DEPLOY_USER@$DEPLOY_HOST:/srv/http/blog-lan/ + DEPLOY_DIR: /srv/http/blog-lan + <<: *deploy_commands when: branch: exclude: - master - #- name: deploy staging - # image: kroniak/ssh-client - # environment: - # DEPLOY_USER: - # from_secret: deploy_user - # DEPLOY_HOST: - # from_secret: deploy_host - # DEPLOY_KEY: - # from_secret: deploy_key - # commands: - # - echo "deploy $DEPLOY_USER@$DEPLOY_HOST" - # - echo "$DEPLOY_KEY" | sed 's/!/\n/g' > deploy_key - # - chmod 0600 deploy_key - # - cat deploy_key - # - scp -i deploy_key -o StrictHostKeyChecking=no output/* $DEPLOY_USER@$DEPLOY_HOST:/srv/http/blog/output/ - # when: - # branch: - # include: - # - master +- name: deploy live + image: kroniak/ssh-client + environment: + DEPLOY_USER: + from_secret: deploy_user + DEPLOY_HOST: + from_secret: deploy_host + DEPLOY_KEY: + from_secret: deploy_key + DEPLOY_DIR: /srv/http/blog + commands: + <<: *deploy_commands + when: + branch: + include: + - master -- 2.45.2 From 75e14157b8419b67303640c6f040eb84e626a270 Mon Sep 17 00:00:00 2001 From: kleph Date: Tue, 27 Oct 2020 17:50:25 +0100 Subject: [PATCH 2/4] Add a basic README file --- README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..ccf2171 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# Blog +Source code of my [blog](https://blog.kleph.eu), using pelican. + +[![Build Status](https://drone.kleph.eu/api/badges/kleph/blog/status.svg)](https://drone.kleph.eu/kleph/blog) -- 2.45.2 From dccc03d3de0f31f89bcf743e608fba62005ddb26 Mon Sep 17 00:00:00 2001 From: kleph Date: Tue, 27 Oct 2020 17:53:28 +0100 Subject: [PATCH 3/4] [CI] Fix yaml --- .drone.yml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/.drone.yml b/.drone.yml index 25b3646..c778cf6 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,6 +1,15 @@ --- kind: pipeline -name: build +name: build and deploy + +deploy_commands_alias: +- &deploy_commands + commands: + - echo "deploy $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_DIR or $${DEPLOY_DIR}" + - echo "$DEPLOY_KEY" | sed 's/!/\n/g' > deploy_key + - chmod 0600 deploy_key + - ssh -i deploy_key -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_HOST rm -Rf $${DEPLOY_DIR}/output/ + - scp -r -i deploy_key -o StrictHostKeyChecking=no output $DEPLOY_USER@$DEPLOY_HOST:$${DEPLOY_DIR} steps: - name: markdown lint @@ -13,19 +22,6 @@ steps: commands: - pelican content -o output -s pelicanconf.py - ---- -deploy_commands: -- &deploy_commands - commands: - - echo "deploy $DEPLOY_USER@$DEPLOY_HOST" - - echo "$DEPLOY_KEY" | sed 's/!/\n/g' > deploy_key - - chmod 0600 deploy_key - - ssh -i deploy_key -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_HOST rm -Rf ${DEPLOY_DIR}/output/ - - scp -r -i deploy_key -o StrictHostKeyChecking=no output $DEPLOY_USER@$DEPLOY_HOST:${DEPLOY_DIR} - -kind: pipeline -name: deploy - name: deploy staging image: kroniak/ssh-client environment: -- 2.45.2 From 6667b393aa4ecce3f152cf7a13eb265516d26d76 Mon Sep 17 00:00:00 2001 From: kleph Date: Tue, 27 Oct 2020 18:40:08 +0100 Subject: [PATCH 4/4] Another lint issue --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ccf2171..5f96698 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Blog + Source code of my [blog](https://blog.kleph.eu), using pelican. [![Build Status](https://drone.kleph.eu/api/badges/kleph/blog/status.svg)](https://drone.kleph.eu/kleph/blog) -- 2.45.2