This commit is contained in:
parent
1b1c1f5f5e
commit
c1c768e8b3
231
.drone.yml
231
.drone.yml
@ -1,200 +1,47 @@
|
|||||||
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: default
|
type: kubernetes
|
||||||
type: docker
|
name: build
|
||||||
steps:
|
|
||||||
# ============ RESTORE CACHE =============
|
|
||||||
# - name: restore node_modules cache
|
|
||||||
# image: appleboy/drone-sftp-cache
|
|
||||||
# settings:
|
|
||||||
# server:
|
|
||||||
# from_secret: cache_server
|
|
||||||
# port: 22
|
|
||||||
# username:
|
|
||||||
# from_secret: cache_server_user
|
|
||||||
# key:
|
|
||||||
# from_secret: cache_server_key
|
|
||||||
# path: /var/cache/drone
|
|
||||||
# restore: true
|
|
||||||
# mount:
|
|
||||||
# - node_modules
|
|
||||||
|
|
||||||
# ============ BUILD STEPS ===============
|
metadata:
|
||||||
- name: build-prod
|
labels:
|
||||||
image: glmdev/node-pnpm:latest
|
pod-security.kubernetes.io/audit: privileged
|
||||||
|
|
||||||
|
services:
|
||||||
|
- name: docker daemon
|
||||||
|
image: docker:dind
|
||||||
|
privileged: true
|
||||||
|
environment:
|
||||||
|
DOCKER_TLS_CERTDIR: ""
|
||||||
|
# when:
|
||||||
|
# event:
|
||||||
|
# - tag
|
||||||
|
# - promote
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: node.js build
|
||||||
|
image: node:18
|
||||||
commands:
|
commands:
|
||||||
- pnpm i --silent
|
- npm add --global pnpm
|
||||||
|
- pnpm i
|
||||||
- rm -f ./node_modules/ngx-monaco-editor/lib/monaco.d.ts
|
- rm -f ./node_modules/ngx-monaco-editor/lib/monaco.d.ts
|
||||||
- sed -i '1d' ./node_modules/ngx-monaco-editor/lib/types.d.ts
|
- sed -i '1d' ./node_modules/ngx-monaco-editor/lib/types.d.ts
|
||||||
- ./node_modules/.bin/ionic build --prod
|
- ./node_modules/.bin/ionic build --prod
|
||||||
- ./node_modules/.bin/ngsw-config ./www/ ./ngsw-config.json /i
|
- ./node_modules/.bin/ngsw-config ./www/ ./ngsw-config.json /i
|
||||||
- tar czf build.tar.gz www
|
- echo -n $(uuidgen) | tee ./www/version.html
|
||||||
|
|
||||||
# =============== REBULD CACHE ==============
|
- name: container build
|
||||||
# - name: rebuild node_modules cache
|
image: docker:latest
|
||||||
# image: appleboy/drone-sftp-cache
|
privileged: true
|
||||||
# settings:
|
commands:
|
||||||
# server:
|
- "while ! docker stats --no-stream; do sleep 1; done"
|
||||||
# from_secret: cache_server
|
- docker image build -t $DOCKER_REGISTRY/noded/frontend .
|
||||||
# port: 22
|
- docker push $DOCKER_REGISTRY/noded/frontend
|
||||||
# username:
|
environment:
|
||||||
# from_secret: cache_server_user
|
DOCKER_HOST: tcp://localhost:2375
|
||||||
# key:
|
DOCKER_REGISTRY:
|
||||||
# from_secret: cache_server_key
|
from_secret: DOCKER_REGISTRY
|
||||||
# path: /var/cache/drone
|
# when:
|
||||||
# rebuild: true
|
# event:
|
||||||
# mount:
|
# - tag
|
||||||
# - node_modules
|
# - promote
|
||||||
|
|
||||||
# =============== RELEASE ===============
|
|
||||||
- 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
|
|
||||||
|
|
||||||
# =============== 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
|
|
||||||
- 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
|
|
||||||
- echo -n "$(uuidgen)" | sudo tee version.html
|
|
||||||
when:
|
|
||||||
event: promote
|
|
||||||
target: staging
|
|
||||||
|
|
||||||
# =============== 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
|
|
||||||
target: production
|
|
||||||
- name: deploy artifacts on production site
|
|
||||||
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
|
|
||||||
- echo -n "$(uuidgen)" | sudo tee version.html
|
|
||||||
when:
|
|
||||||
event: promote
|
|
||||||
target: production
|
|
||||||
|
|
||||||
# =============== 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 [noded-frontend @ ${DRONE_BUILD_NUMBER}]",
|
|
||||||
"message": "Build completed successfully. (Changes by ${DRONE_COMMIT_AUTHOR})",
|
|
||||||
"priority": 4
|
|
||||||
}
|
|
||||||
when:
|
|
||||||
status: success
|
|
||||||
event:
|
|
||||||
exclude:
|
|
||||||
- promote
|
|
||||||
- name: send build error notifications
|
|
||||||
image: plugins/webhook
|
|
||||||
settings:
|
|
||||||
urls:
|
|
||||||
from_secret: notify_webhook_url
|
|
||||||
content_type: application/json
|
|
||||||
template: |
|
|
||||||
{
|
|
||||||
"title": "Drone-CI [noded-frontend @ ${DRONE_BUILD_NUMBER}]",
|
|
||||||
"message": "Build failed! (Changes by ${DRONE_COMMIT_AUTHOR})",
|
|
||||||
"priority": 6
|
|
||||||
}
|
|
||||||
when:
|
|
||||||
status: failure
|
|
||||||
event:
|
|
||||||
exclude:
|
|
||||||
- promote
|
|
||||||
|
|
||||||
# =============== DEPLOY NOTIFICATIONS ===============
|
|
||||||
- name: send deploy success notifications
|
|
||||||
image: plugins/webhook
|
|
||||||
settings:
|
|
||||||
urls:
|
|
||||||
from_secret: notify_webhook_url
|
|
||||||
content_type: application/json
|
|
||||||
template: |
|
|
||||||
{
|
|
||||||
"title": "Drone-Deploy [noded-frontend @ ${DRONE_BUILD_NUMBER} to ${DRONE_DEPLOY_TO}]",
|
|
||||||
"message": "Deployment completed successfully. (Changes by ${DRONE_COMMIT_AUTHOR})",
|
|
||||||
"priority": 4
|
|
||||||
}
|
|
||||||
when:
|
|
||||||
status: success
|
|
||||||
event:
|
|
||||||
- promote
|
|
||||||
- name: send deploy error notifications
|
|
||||||
image: plugins/webhook
|
|
||||||
settings:
|
|
||||||
urls:
|
|
||||||
from_secret: notify_webhook_url
|
|
||||||
content_type: application/json
|
|
||||||
template: |
|
|
||||||
{
|
|
||||||
"title": "Drone-Deploy [noded-frontend @ ${DRONE_BUILD_NUMBER} to ${DRONE_DEPLOY_TO}]",
|
|
||||||
"message": "Deployment failed! (Changes by ${DRONE_COMMIT_AUTHOR})",
|
|
||||||
"priority": 6
|
|
||||||
}
|
|
||||||
when:
|
|
||||||
status: failure
|
|
||||||
event:
|
|
||||||
- promote
|
|
||||||
|
619
pnpm-lock.yaml
619
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user