feat: updated the deploy pipeline
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
surtur 2020-07-09 09:38:50 +02:00
parent 0f9d634442
commit a9c1c635e7
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
2 changed files with 35 additions and 165 deletions

@ -1,7 +1,7 @@
---
kind: pipeline
type: docker
name: build
name: 'build and deploy'
steps:
- name: hugo-extended
@ -13,43 +13,25 @@ steps:
- hugo version
- hugo --gc=true --minify
---
kind: pipeline
type: docker
name: deploy
platform:
os: linux
arch: amd64
clone:
disable: true
steps:
- name: ssh-deploy
pull: if-not-exists
image: appleboy/drone-ssh:latest
settings:
host:
from_secret: hugo_host
username:
from_secret: hugo_user
password:
from_secret: hugo_passwd
script_stop: true
script:
- cd ~/dtya
- eval $(ssh-agent)
- ssh-add ~/.ssh/overlord
- git pull -4
- ./deploy "0.73.0"
- name: deploy
pull: always
image: immawanderer/alpine-rsync:latest
when:
status:
- success
depends_on:
- build
depends_on:
- hugo-extended
environment:
OL:
from_secret: hugo_user
OL_P:
from_secret: hugo_passwd
OL_D:
from_secret: hugo_dir
commands:
- export DAT_DIR=$OL_D
- export RSYNC_PASSWORD=$OL_P
- rsync -av --delete chown $OL public/ $OL@dotya.ml:$DAT_DIR
---
@ -75,99 +57,7 @@ trigger:
- failure
depends_on:
- build
steps:
- name: discord
pull: if-not-exists
image: appleboy/drone-discord:latest
settings:
message: >
{{#success build.status}}
✅ [Build #{{build.number}}]({{build.link}}) of `{{repo.name}}` succeeded.
event: **`{{build.event}}`**
commit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}`
```{{commit.message}}```
{{else}}
❌ [Build #{{build.number}}]({{build.link}}) of `{{repo.name}}` failed.
event: **`${DRONE_BUILD_EVENT}`**
commit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}`
```{{commit.message}}```
{{/success}}
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
---
kind: pipeline
name: notifications-cronbuild
platform:
os: linux
arch: amd64
clone:
disable: true
trigger:
event:
- cron
cron:
- hourly
- hourly-build
status:
- success
- failure
depends_on:
- build
steps:
- name: discord
pull: always
image: appleboy/drone-discord:latest
settings:
message: >
{{#success build.status}}
✅ [Hourly build #{{build.number}}]({{build.link}}) of `{{repo.name}}` succeeded.
event: **`{{build.event}}`**
commit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}`
{{else}}
❌ [Hourly build #{{build.number}}]({{build.link}}) of `{{repo.name}}` failed.
event: **`${DRONE_BUILD_EVENT}`**
commit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}`
```{{commit.message}}```
{{/success}}
webhook_id:
from_secret: discord_webhook_hourly_id
webhook_token:
from_secret: discord_webhook_hourly_token
---
kind: pipeline
name: notifications-deploy
platform:
os: linux
arch: amd64
clone:
disable: true
trigger:
branch:
- master
- "dev*"
event:
- push
- tag
status:
- success
- failure
depends_on:
- deploy
- 'build and deploy'
steps:
- name: discord
@ -182,7 +72,9 @@ steps:
{{else}}
❌ [Build #{{build.number}}]({{build.link}}) of `{{repo.name}}` failed to deploy.
event: **`${DRONE_BUILD_EVENT}`**
failed stage(s): **`${DRONE_FAILED_STAGES}`**
commit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}`
```{{commit.message}}```
{{/success}}
webhook_id:
from_secret: discord_webhook_id
@ -191,7 +83,7 @@ steps:
---
kind: pipeline
name: notifications-cron-deploy
name: notifications-cron
platform:
os: linux
@ -211,7 +103,7 @@ trigger:
- failure
depends_on:
- deploy
- 'build and deploy'
steps:
- name: discord
@ -226,7 +118,9 @@ steps:
{{else}}
❌ [Hourly build #{{build.number}}]({{build.link}}) of `{{repo.name}}` failed to deploy.
event: **`${DRONE_BUILD_EVENT}`**
failed stage(s): **`${DRONE_FAILED_STAGES}`**
commit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}`
```{{commit.message}}```
{{/success}}
webhook_id:
from_secret: discord_webhook_hourly_id

24
deploy

@ -1,24 +0,0 @@
#!/bin/bash
USR=dotyaoverlord
HOST=dotya.ml
DIR=public/
export HUGO_VERSION=$1
PATH=~/.local/bin:~/bin:$PATH
gethugo $HUGO_VERSION
git submodule init
git submodule update --remote --merge
which hugo
hugo version
hugo --gc=true --minify
if [ $USER = $USR ]; then
rsync -av --delete public/ ~/${DIR}
else
rsync -avz --delete public/ ${USR}@${HOST}:~/${DIR}
fi
exit 0