2021-06-02 03:21:29 +00:00
|
|
|
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
|
2021-10-18 18:53:37 +00:00
|
|
|
target: /var/nfs/storage/static/sites/extollo
|
2021-06-02 03:21:29 +00:00
|
|
|
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:
|
2021-10-18 19:02:00 +00:00
|
|
|
- cd /var/nfs/storage/static/sites/extollo
|
2021-06-02 03:21:29 +00:00
|
|
|
- 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
|
|
|
|
---
|
|
|
|
|
2021-03-29 16:42:45 +00:00
|
|
|
kind: pipeline
|
|
|
|
name: default
|
|
|
|
type: docker
|
|
|
|
steps:
|
2021-03-29 18:51:51 +00:00
|
|
|
- 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
|
|
|
|
|
2021-03-31 03:34:57 +00:00
|
|
|
- name: remove lockfile
|
|
|
|
image: glmdev/node-pnpm:latest
|
|
|
|
commands:
|
|
|
|
- rm -rf pnpm-lock.yaml
|
|
|
|
when:
|
|
|
|
event:
|
|
|
|
exclude: tag
|
|
|
|
|
2021-09-21 18:42:06 +00:00
|
|
|
- name: Install dependencies
|
2021-03-29 16:42:45 +00:00
|
|
|
image: glmdev/node-pnpm:latest
|
|
|
|
commands:
|
|
|
|
- pnpm i
|
2021-09-21 18:42:06 +00:00
|
|
|
|
|
|
|
- name: Lint code
|
|
|
|
image: glmdev/node-pnpm:latest
|
|
|
|
commands:
|
|
|
|
- pnpm lint
|
|
|
|
|
|
|
|
- name: build module
|
|
|
|
image: glmdev/node-pnpm:latest
|
|
|
|
commands:
|
2021-03-29 16:42:45 +00:00
|
|
|
- pnpm build
|
2021-03-29 18:51:51 +00:00
|
|
|
- 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
|
2021-03-29 16:42:45 +00:00
|
|
|
|
|
|
|
- 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
|
2021-03-29 18:51:51 +00:00
|
|
|
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
|
2021-03-29 16:42:45 +00:00
|
|
|
|
|
|
|
- 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
|
2021-03-29 18:51:51 +00:00
|
|
|
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
|