229 lines
5.5 KiB
YAML
229 lines
5.5 KiB
YAML
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/general/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
|
|
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
|
|
commands:
|
|
- pnpm i
|
|
|
|
- name: Lint code
|
|
image: glmdev/node-pnpm:latest
|
|
commands:
|
|
- pnpm lint
|
|
|
|
- name: build module
|
|
image: glmdev/node-pnpm:latest
|
|
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
|