220 lines
4.7 KiB
YAML
220 lines
4.7 KiB
YAML
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: build
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
trigger:
|
|
branch: master
|
|
event: [push, pull_request]
|
|
|
|
steps:
|
|
- name: submodules
|
|
pull: always
|
|
depends_on: [clone]
|
|
image: docker.io/alpine/git
|
|
commands:
|
|
- git --version
|
|
- git submodule update --init --recursive
|
|
|
|
- name: pull alpine-hugo
|
|
pull: always
|
|
depends_on: [clone]
|
|
image: docker.io/immawanderer/alpine-hugo:hugo-v0.104.1
|
|
commands:
|
|
- uname -r
|
|
|
|
- name: hugo-extended
|
|
pull: if-not-exists
|
|
depends_on:
|
|
- submodules
|
|
- pull alpine-hugo
|
|
image: docker.io/immawanderer/alpine-hugo:hugo-v0.104.1
|
|
commands:
|
|
- hugo version
|
|
- hugo --gc=true --minify
|
|
|
|
# perform basic checks on failure
|
|
- name: diagnostics
|
|
image: docker.io/plugins/drone-diagnostics
|
|
pull: if-not-exists
|
|
commands:
|
|
- env
|
|
- ls -lah
|
|
- ping git.dotya.ml -w 5
|
|
- ping www.github.com -w 5
|
|
- traceroute -T -p 443 git.dotya.ml
|
|
- traceroute -T -p 443 www.github.com
|
|
- dig dotya.ml
|
|
- echo "end of test"
|
|
when:
|
|
status:
|
|
- failure
|
|
|
|
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: deploy
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
trigger:
|
|
branch:
|
|
- master
|
|
event:
|
|
exclude: [pull_request, tag]
|
|
|
|
environment:
|
|
# ref: https://www.docker.com/blog/faster-builds-in-compose-thanks-to-buildkit-support/
|
|
COMPOSE_DOCKER_CLI_BUILD: 1
|
|
DOCKER_BUILDKIT: 1
|
|
|
|
node:
|
|
r: main
|
|
|
|
depends_on:
|
|
- build
|
|
|
|
steps:
|
|
- name: submodules
|
|
pull: always
|
|
depends_on: [clone]
|
|
image: docker.io/alpine/git
|
|
commands:
|
|
- git --version
|
|
- git submodule update --init --recursive
|
|
|
|
- name: pull alpine-hugo
|
|
pull: always
|
|
depends_on: [clone]
|
|
image: docker.io/immawanderer/alpine-hugo:hugo-v0.104.1
|
|
commands:
|
|
- uname -r
|
|
|
|
- name: pull tmaier/docker-compose
|
|
pull: always
|
|
depends_on: [clone]
|
|
image: docker.io/tmaier/docker-compose:latest
|
|
commands:
|
|
- uname -r
|
|
- cat /etc/os-release
|
|
|
|
- name: hugo-extended
|
|
pull: if-not-exists
|
|
depends_on:
|
|
- submodules
|
|
- pull alpine-hugo
|
|
image: docker.io/immawanderer/alpine-hugo:hugo-v0.104.1
|
|
commands:
|
|
- hugo version
|
|
- hugo --gc=true --minify
|
|
|
|
- name: rm-intermediate
|
|
pull: if-not-exists
|
|
image: docker.io/immawanderer/alpine-hugo:hugo-v0.104.1
|
|
depends_on:
|
|
- hugo-extended
|
|
commands:
|
|
- rm -rf ./public
|
|
|
|
- name: build
|
|
pull: always
|
|
image: docker.io/tmaier/docker-compose:latest
|
|
depends_on:
|
|
- pull tmaier/docker-compose
|
|
- rm-intermediate
|
|
volumes:
|
|
- name: s
|
|
path: /var/run/docker.sock
|
|
commands:
|
|
- docker-compose build --no-cache
|
|
when:
|
|
branch: master
|
|
status: success
|
|
|
|
- name: deploy
|
|
pull: always
|
|
image: docker.io/tmaier/docker-compose:latest
|
|
depends_on:
|
|
- build
|
|
volumes:
|
|
- name: s
|
|
path: /var/run/docker.sock
|
|
commands:
|
|
- docker-compose -p ${DRONE_REPO_NAME} up -d --remove-orphans
|
|
when:
|
|
branch: master
|
|
status: success
|
|
|
|
# perform basic checks on failure
|
|
- name: diagnostics
|
|
image: docker.io/plugins/drone-diagnostics
|
|
pull: if-not-exists
|
|
commands:
|
|
- env
|
|
- ls -lah
|
|
- ping git.dotya.ml -w 5
|
|
- ping www.github.com -w 5
|
|
- traceroute -T -p 443 git.dotya.ml
|
|
- traceroute -T -p 443 www.github.com
|
|
- dig dotya.ml
|
|
- echo "end of test"
|
|
when:
|
|
status:
|
|
- failure
|
|
|
|
volumes:
|
|
- name: s
|
|
host:
|
|
path: /run/docker.sock
|
|
|
|
---
|
|
kind: pipeline
|
|
name: notifications
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
trigger:
|
|
branch: master
|
|
event: [push, tag, pull_request]
|
|
status: [success, failure]
|
|
|
|
depends_on: [build]
|
|
|
|
steps:
|
|
- name: discord
|
|
pull: if-not-exists
|
|
image: docker.io/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}}`
|
|
{{else}}
|
|
❌ [Build #{{build.number}}]({{build.link}}) of `{{repo.name}}` failed.
|
|
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
|
|
webhook_token:
|
|
from_secret: discord_webhook_token
|
|
---
|
|
kind: signature
|
|
hmac: 4dd377f0d3e9ea7f747d8a1bdca3c16d9bfe49e7daac681aedfa07b5caf8018a
|
|
|
|
...
|