frontend/.drone.yml

127 lines
3.2 KiB
YAML
Raw Normal View History

2020-10-05 22:49:10 +00:00
kind: pipeline
name: default
steps:
2020-10-05 23:02:52 +00:00
# ============ BUILD STEPS ===============
2020-10-05 22:49:10 +00:00
- name: build-prod
image: node:14
commands:
- npm i
- npm install @ionic/cli
2020-10-05 22:52:50 +00:00
- ./node_modules/.bin/ionic build --prod
2020-10-05 22:49:10 +00:00
- tar czf build.tar.gz www
2020-10-05 23:02:52 +00:00
# =============== RELEASE ===============
2020-10-05 22:49:10 +00:00
- name: release
image: plugins/gitea-release
settings:
api_key:
from_secret: gitea_api_key
base_url: https://code.garrettmills.dev
files: build.tar.gz
title: ${DRONE_TAG}
when:
event: tag
2020-10-05 23:02:52 +00:00
# =============== DEPLOY TO DEV SITE ===============
- name: copy artifacts to staging site
image: appleboy/drone-scp
settings:
host:
from_secret: dev_site_host
username:
from_secret: dev_site_user
key:
from_secret: dev_site_key
port: 22
source: build.tar.gz
target: /etc/glmdev/noded
when:
event: promote
target: staging
2020-10-05 23:27:21 +00:00
- name: deploy artifacts on staging site
image: appleboy/drone-ssh
settings:
host:
from_secret: dev_site_host
username:
from_secret: dev_site_user
key:
from_secret: dev_site_key
port: 22
script:
- cd /etc/glmdev/noded
- rm -rf www
- tar xzf build.tar.gz
- cd www
2020-10-06 00:12:33 +00:00
- sed -i 's/<base href="\\/" \\/>/<base href="\\/i\\/"\\/>/' index.html
2020-10-05 23:27:21 +00:00
- sed -i 's/Ionic App/Noded/' index.html
when:
event: promote
target: staging
2020-10-05 23:02:52 +00:00
2020-10-06 00:46:28 +00:00
# =============== DEPLOY TO PROD SITE ===============
- name: copy artifacts to production site
image: appleboy/drone-scp
settings:
host:
from_secret: prod_site_host
username:
from_secret: prod_site_user
key:
from_secret: prod_site_key
port: 22
source: build.tar.gz
target: /etc/glmdev/noded-prod
when:
event: promote
2020-10-06 00:56:21 +00:00
target: production
2020-10-06 00:47:20 +00:00
- name: deploy artifacts on production site
2020-10-06 00:46:28 +00:00
image: appleboy/drone-ssh
settings:
host:
from_secret: prod_site_host
username:
from_secret: prod_site_user
key:
from_secret: prod_site_key
port: 22
script:
- cd /etc/glmdev/noded-prod
- rm -rf www
- tar xzf build.tar.gz
- cd www
- sed -i 's/<base href="\\/" \\/>/<base href="\\/i\\/"\\/>/' index.html
- sed -i 's/Ionic App/Noded/' index.html
when:
event: promote
target: production
2020-10-05 23:02:52 +00:00
# =============== NOTIFICATIONS ===============
2020-10-05 22:49:10 +00:00
- name: send success notifications
image: plugins/webhook
settings:
urls:
from_secret: notify_webhook_url
content_type: application/json
template: |
{
"title": "Drone-CI [noded-frontend]",
"message": "Build ${DRONE_BUILD_NUMBER} completed successfully.",
"priority": 4
}
when:
status: success
- name: send error notifications
image: plugins/webhook
settings:
urls:
from_secret: notify_webhook_url
content_type: application/json
template: |
{
"title": "Drone-CI [noded-frontend]",
"message": "Build ${DRONE_BUILD_NUMBER} failed!",
"priority": 6
}
when:
2020-10-05 23:02:52 +00:00
status: failure