mentorenwahl/.drone.yml

205 lines
3.7 KiB
YAML

---
kind: pipeline
type: docker
name: default
steps:
- name: shellcheck
image: koalaman/shellcheck-alpine
commands:
- cd scripts
- find -name "*.sh" | xargs shellcheck
- name: docs
image: michaelfbryan/mdbook-docker-image
volumes:
- name: cache
path: /cache
commands:
- cd docs
- mdbook build
- name: rebuild-cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /cache
settings:
rebuild: true
mount:
- ./docs/book
depends_on:
- docs
volumes:
- name: cache
host:
path: /tmp/cache
---
kind: pipeline
type: docker
name: auth
steps:
- name: build
image: docker.io/docker
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- docker compose build auth --progress plain
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
---
kind: pipeline
type: docker
name: backend
steps:
- name: ameba
image: veelenga/ameba
commands:
- cd backend
- ameba micrate/src src
- name: deps
image: crystallang/crystal:1.7.3-alpine
volumes:
- name: lib
path: /drone/src/backend/lib
- name: cache
path: /cache
commands:
- cd backend
- shards install
- name: docs
image: crystallang/crystal:1.7.3-alpine
volumes:
- name: lib
path: /drone/src/backend/lib
- name: cache
path: /cache
commands:
- cd backend
- make docs
depends_on:
- ameba
- deps
- name: rebuild-cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /cache
settings:
rebuild: true
mount:
- ./backend/docs
depends_on:
- docs
- name: build
image: docker.io/docker
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- docker compose build api --progress plain
depends_on:
- ameba
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
- name: cache
host:
path: /tmp/cache
---
kind: pipeline
type: docker
name: frontend
steps:
- name: build
image: docker.io/docker
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- docker compose build frontend --progress plain
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
---
kind: pipeline
type: docker
name: deploy-docs
steps:
- name: restore-cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /cache
settings:
restore: true
mount:
- ./docs/book
- ./backend/docs
- name: prepare-pages
image: bitnami/git
volumes:
- name: cache
path: /cache
- name: pages
path: /tmp/pages
commands:
- git clone --depth 1 --branch pages https://git.dergrimm.net/mentorenwahl/mentorenwahl.git /tmp/pages_old
- cp -r /tmp/pages_old/.git /tmp/pages
- cp -r ./docs/book/* /tmp/pages
- mkdir -p /tmp/pages/_api/backend
- cp -r ./backend/docs/* /tmp/pages/_api/backend
depends_on:
- restore-cache
- name: deploy-pages
image: appleboy/drone-git-push
volumes:
- name: pages
path: /tmp/pages
settings:
remote:
from_secret: deploy_remote
force: false
commit: true
commit_message: "[CI] Deploy pages"
branch: pages
local_ref: pages
path: /tmp/pages
depends_on:
- prepare-pages
volumes:
- name: cache
host:
path: /tmp/cache
- name: pages
temp: {}
depends_on:
- default
- auth
- backend
- frontend
trigger:
branch:
- main
event:
- push
- promote