From ec5b59d0004870350e22f08e7f2af0e6faa46ad2 Mon Sep 17 00:00:00 2001 From: surtur Date: Tue, 10 Mar 2020 03:49:49 +0100 Subject: [PATCH] updated deploy script + .drone.yml deploy pipeline --- .drone.yml | 40 +++++++++++++++++----------------------- deploy | 2 +- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/.drone.yml b/.drone.yml index df117bb..00bb167 100644 --- a/.drone.yml +++ b/.drone.yml @@ -20,30 +20,24 @@ type: docker name: deploy steps: -- name: rsync-deploy +- name: ssh-deploy pull: if-not-exists - image: immawanderer/archlinux-hugo:latest - environment: - HUGO_KEY: - from_secret: hugo_key - HUGO_PUB: - from_secret: hugo_pub - HUGO_USER: - from_secret: hugo_user - HUGO_HOST: + image: appleboy/drone-ssh:latest + settings: + host: from_secret: hugo_host - HUGO_DIR: - from_secret: hugo_dir - commands: - - git submodule init - - git submodule update - - rm -rfv ./public - - hugo --gc=true --minify - - echo $HUGO_KEY > ./hugo_deploy - - echo $HUGO_PUB > ./hugo_deploy.pub - - chmod -v 600 ./hugo_deploy - - rsync -av -e "ssh -vv -o KexAlgorithms=curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256 -o PreferredAuthentications=publickey -o PubkeyAuthentication=yes -o PasswordAuthentication=no -c aes256-ctr,aes256-cbc -o StrictHostKeyChecking=no -i ./hugo_deploy" --delete public/ $HUGO_USER@$HUGO_HOST:$HUGO_DIR - - shred -zuv -n 7 ./hugo_deploy* + username: + from_secret: hugo_user + key: + from_secret: hugo_key + password: + from_secret: hugo_pub + script_stop: true + script: + - echo deploy from drone started + - cd ~/dtya + - git pull + - ./deploy when: status: - success @@ -83,7 +77,7 @@ steps: pull: always image: appleboy/drone-discord:1.2.4 settings: - message: "{{#success build.status}} ✅ Build #{{build.number}} of `{{repo.name}}` succeeded.\n\ncommit `${DRONE_COMMIT_SHA:0:7}` by {{commit.author}} on `{{commit.branch}}`:\n``` {{commit.message}} ```\n\n{{ build.link }}\n\n {{else}} ❌ Build #{{build.number}} of `{{repo.name}}` failed.\n\ncommit `${DRONE_COMMIT_SHA:0:7}` by {{commit.author}} on `{{commit.branch}}`:\n``` {{commit.message}} ```\n\n{{ build.link }}\n\n {{/success}}\n" + message: "{{#success build.status}} ✅ Build #{{build.number}} of `{{repo.name}}` succeeded.\n\ncommit `${DRONE_COMMIT_SHA:0:7}` by {{commit.author}} on `{{commit.branch}}`:\n``` {{commit.message}} ```\n{{ build.link }}\n\n{{else}} ❌ Build #{{build.number}} of `{{repo.name}}` failed.\n\ncommit `${DRONE_COMMIT_SHA:0:7}` by {{commit.author}} on `{{commit.branch}}`:\n``` {{commit.message}} ```\n{{ build.link }}\n\n{{/success}}\n" webhook_id: from_secret: discord_webhook_id webhook_token: diff --git a/deploy b/deploy index b2d132e..ed4daf9 100755 --- a/deploy +++ b/deploy @@ -6,6 +6,6 @@ DIR=public/ git submodule init git submodule update -../hugo --gc=true && rsync -avz --delete public/ ${USER}@${HOST}:~/${DIR} +../hugo --gc=true --minify && rsync -avz --delete public/ ${USER}@${HOST}:~/${DIR} exit 0