135 lines
3.3 KiB
YAML
135 lines
3.3 KiB
YAML
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: 'build and deploy'
|
|
|
|
steps:
|
|
- name: hugo-extended
|
|
pull: always
|
|
image: immawanderer/fedora-hugo:latest
|
|
commands:
|
|
- git submodule init
|
|
- git submodule update
|
|
- hugo version
|
|
- hugo --gc=true --minify
|
|
|
|
- name: deploy
|
|
pull: always
|
|
image: immawanderer/alpine-rsync:latest
|
|
when:
|
|
status:
|
|
- success
|
|
depends_on:
|
|
- hugo-extended
|
|
environment:
|
|
OL:
|
|
from_secret: hugo_user
|
|
OL_K:
|
|
from_secret: hugo_k
|
|
OL_K_PUB:
|
|
from_secret: hugo_k_pub
|
|
OL_D:
|
|
from_secret: hugo_dir
|
|
commands:
|
|
- echo -n $OL_K > ol_k
|
|
- echo -n $OL_K_PUB > ol_k.pub
|
|
- chmod -v 0600 ./ol_k
|
|
- chmod -v 0644 ./ol_k.pub
|
|
- rsync --rsh="ssh -i ./ol_k -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" -av --delete chown $OL public/ $OL@dotya.ml:$OL_D
|
|
|
|
|
|
---
|
|
kind: pipeline
|
|
name: notifications
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
trigger:
|
|
branch:
|
|
- master
|
|
- "dev*"
|
|
event:
|
|
- push
|
|
- tag
|
|
status:
|
|
- success
|
|
- failure
|
|
|
|
depends_on:
|
|
- 'build and deploy'
|
|
|
|
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}}` has been successfully deployed.
|
|
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}}
|
|
❌ [Build #{{build.number}}]({{build.link}}) of `{{repo.name}}` failed to deploy.
|
|
event: **`${DRONE_BUILD_EVENT}`**
|
|
failed stage(s): **`${DRONE_FAILED_STAGES}`**
|
|
failed step(s): **`${DRONE_FAILED_STEPS}`**
|
|
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-cron
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
trigger:
|
|
event:
|
|
- cron
|
|
cron:
|
|
- hourly
|
|
- hourly-build
|
|
status:
|
|
- success
|
|
- failure
|
|
|
|
depends_on:
|
|
- 'build and deploy'
|
|
|
|
steps:
|
|
- name: discord
|
|
pull: always
|
|
image: appleboy/drone-discord:latest
|
|
settings:
|
|
message: >
|
|
{{#success build.status}}
|
|
✅ [Hourly build #{{build.number}}]({{build.link}}) of `{{repo.name}}` has been successfully deployed.
|
|
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 to deploy.
|
|
event: **`${DRONE_BUILD_EVENT}`**
|
|
failed stage(s): **`${DRONE_FAILED_STAGES}`**
|
|
failed step(s): **`${DRONE_FAILED_STEPS}`**
|
|
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
|