This commit is contained in:
parent
bbafd54dcc
commit
5395fb9054
250
.drone.yml
250
.drone.yml
@ -1,228 +1,40 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: docs
|
||||
steps:
|
||||
# ============ BUILD STEPS ===============
|
||||
- name: build documentation
|
||||
image: glmdev/node-pnpm:latest
|
||||
commands:
|
||||
- pnpm i --silent
|
||||
- pnpm docs:build
|
||||
- cd docs && tar czf ../extollo_api_documentation.tar.gz www
|
||||
|
||||
# =============== DEPLOY STEPS ===============
|
||||
- name: copy artifacts to static host
|
||||
image: appleboy/drone-scp
|
||||
settings:
|
||||
host:
|
||||
from_secret: docs_deploy_host
|
||||
username:
|
||||
from_secret: docs_deploy_user
|
||||
key:
|
||||
from_secret: docs_deploy_key
|
||||
port: 22
|
||||
source: extollo_api_documentation.tar.gz
|
||||
target: /var/nfs/storage/static/sites/extollo
|
||||
when:
|
||||
event: promote
|
||||
target: docs
|
||||
|
||||
- name: deploy artifacts on static host
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
host:
|
||||
from_secret: docs_deploy_host
|
||||
username:
|
||||
from_secret: docs_deploy_user
|
||||
key:
|
||||
from_secret: docs_deploy_key
|
||||
port: 22
|
||||
script:
|
||||
- cd /var/nfs/storage/static/sites/extollo
|
||||
- rm -rf docs
|
||||
- tar xzf extollo_api_documentation.tar.gz
|
||||
- rm -rf extollo_api_documentation.tar.gz
|
||||
- mv www docs
|
||||
when:
|
||||
event: promote
|
||||
target: docs
|
||||
|
||||
# =============== BUILD NOTIFICATIONS ===============
|
||||
- name: send build success notifications
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls:
|
||||
from_secret: notify_webhook_url
|
||||
content_type: application/json
|
||||
template: |
|
||||
{
|
||||
"title": "Drone-CI [extollo/docs @ ${DRONE_BUILD_NUMBER}]",
|
||||
"message": "Build & deploy completed successfully.",
|
||||
"priority": 4
|
||||
}
|
||||
when:
|
||||
status: success
|
||||
event:
|
||||
- promote
|
||||
|
||||
- name: send build error notifications
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls:
|
||||
from_secret: notify_webhook_url
|
||||
content_type: application/json
|
||||
template: |
|
||||
{
|
||||
"title": "Drone-CI [extollo/docs @ ${DRONE_BUILD_NUMBER}]",
|
||||
"message": "Documentation build failed!",
|
||||
"priority": 6
|
||||
}
|
||||
when:
|
||||
status: failure
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
name: default
|
||||
type: docker
|
||||
type: kubernetes
|
||||
name: docs
|
||||
|
||||
metadata:
|
||||
labels:
|
||||
pod-security.kubernetes.io/audit: privileged
|
||||
|
||||
services:
|
||||
- name: docker daemon
|
||||
image: docker:dind
|
||||
privileged: true
|
||||
environment:
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
|
||||
steps:
|
||||
- name: post build in progress comment to PR
|
||||
image: tsakidev/giteacomment:latest
|
||||
settings:
|
||||
gitea_token:
|
||||
from_secret: gitea_token
|
||||
gitea_base_url: https://code.garrettmills.dev
|
||||
comment: "Build ${DRONE_BUILD_NUMBER} started."
|
||||
when:
|
||||
event: pull_request
|
||||
|
||||
- name: remove lockfile
|
||||
image: glmdev/node-pnpm:latest
|
||||
commands:
|
||||
- rm -rf pnpm-lock.yaml
|
||||
when:
|
||||
event:
|
||||
exclude: tag
|
||||
|
||||
- name: Install dependencies
|
||||
image: glmdev/node-pnpm:latest
|
||||
- name: typedoc build
|
||||
image: node:18
|
||||
commands:
|
||||
- "npm add --global pnpm"
|
||||
- pnpm i
|
||||
- pnpm run docs:build
|
||||
|
||||
- name: Lint code
|
||||
image: glmdev/node-pnpm:latest
|
||||
- name: container build
|
||||
image: docker:latest
|
||||
privileged: true
|
||||
commands:
|
||||
- pnpm lint
|
||||
- docker image build docs -t $DOCKER_REGISTRY/extollo/docs:latest
|
||||
- docker push $DOCKER_REGISTRY/extollo/docs:latest
|
||||
environment:
|
||||
DOCKER_HOST: tcp://localhost:2375
|
||||
DOCKER_REGISTRY:
|
||||
from_secret: DOCKER_REGISTRY
|
||||
|
||||
- name: build module
|
||||
image: glmdev/node-pnpm:latest
|
||||
- name: k8s rollout
|
||||
image: bitnami/kubectl
|
||||
commands:
|
||||
- pnpm build
|
||||
- mkdir artifacts
|
||||
- tar czf artifacts/extollo-lib.tar.gz lib
|
||||
|
||||
- name: create Gitea release
|
||||
image: plugins/gitea-release
|
||||
settings:
|
||||
api_key:
|
||||
from_secret: gitea_token
|
||||
base_url: https://code.garrettmills.dev
|
||||
checksum: md5
|
||||
title: ${DRONE_TAG}
|
||||
files: "artifacts/*"
|
||||
when:
|
||||
event: tag
|
||||
status: success
|
||||
|
||||
- name: prepare NPM release
|
||||
image: glmdev/node-pnpm:latest
|
||||
commands:
|
||||
- rm -rf artifacts
|
||||
when:
|
||||
event: tag
|
||||
status: success
|
||||
|
||||
- name: create NPM release
|
||||
image: plugins/npm
|
||||
settings:
|
||||
username: extollo_bot
|
||||
password:
|
||||
from_secret: npm_password
|
||||
email: extollo@garrettmills.dev
|
||||
when:
|
||||
event: tag
|
||||
status: success
|
||||
|
||||
- name: send build success notifications
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls:
|
||||
from_secret: notify_webhook_url
|
||||
content_type: application/json
|
||||
template: |
|
||||
{
|
||||
"title": "Drone-CI [extollo/lib @ ${DRONE_BUILD_NUMBER}]",
|
||||
"message": "Build completed successfully.",
|
||||
"priority": 4
|
||||
}
|
||||
when:
|
||||
status: success
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
- tag
|
||||
|
||||
- name: send publish success notifications
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls:
|
||||
from_secret: notify_webhook_url
|
||||
content_type: application/json
|
||||
template: |
|
||||
{
|
||||
"title": "Drone-CI [extollo/lib @ ${DRONE_BUILD_NUMBER}]",
|
||||
"message": "Successfully published tag ${DRONE_TAG}.",
|
||||
"priority": 4
|
||||
}
|
||||
when:
|
||||
status: success
|
||||
event: tag
|
||||
|
||||
- name: post build success comment to PR
|
||||
image: tsakidev/giteacomment:latest
|
||||
settings:
|
||||
gitea_token:
|
||||
from_secret: gitea_token
|
||||
gitea_base_url: https://code.garrettmills.dev
|
||||
comment: "Build ${DRONE_BUILD_NUMBER} completed successfully."
|
||||
when:
|
||||
status: success
|
||||
event: pull_request
|
||||
|
||||
- name: send build error notifications
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls:
|
||||
from_secret: notify_webhook_url
|
||||
content_type: application/json
|
||||
template: |
|
||||
{
|
||||
"title": "Drone-CI [extollo/lib @ ${DRONE_BUILD_NUMBER}]",
|
||||
"message": "Build failed!",
|
||||
"priority": 6
|
||||
}
|
||||
when:
|
||||
status: failure
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
- name: post build error comment to PR
|
||||
image: tsakidev/giteacomment:latest
|
||||
settings:
|
||||
gitea_token:
|
||||
from_secret: gitea_token
|
||||
gitea_base_url: https://code.garrettmills.dev
|
||||
comment: "Build ${DRONE_BUILD_NUMBER} failed!"
|
||||
when:
|
||||
status: failure
|
||||
event: pull_request
|
||||
- cd docs && kubectl apply -f .
|
||||
- kubectl rollout restart -n extollo deployment/docs
|
||||
|
Loading…
Reference in New Issue
Block a user