85 lines
1.8 KiB
YAML
85 lines
1.8 KiB
YAML
kind: pipeline
|
|
name: default
|
|
|
|
steps:
|
|
- name: restore cache
|
|
image: drillster/drone-volume-cache
|
|
settings:
|
|
restore: true
|
|
mount:
|
|
- ./node_modules
|
|
volumes:
|
|
- name: cache
|
|
path: /cache
|
|
|
|
- name: npm install
|
|
image: node:12
|
|
commands:
|
|
- npm install
|
|
|
|
- name: npm run build
|
|
image: node:12
|
|
commands:
|
|
- npm run build
|
|
|
|
- name: rebuild cache
|
|
image: drillster/drone-volume-cache
|
|
settings:
|
|
rebuild: true
|
|
mount:
|
|
- ./node_modules
|
|
volumes:
|
|
- name: cache
|
|
path: /cache
|
|
|
|
- name: show tag
|
|
image: alpine
|
|
commands:
|
|
- echo ${DRONE_BUILD_CREATED}
|
|
|
|
- name: deploy static files
|
|
image: node:12
|
|
commands:
|
|
- git config --global user.email "${DRONE_COMMIT_AUTHOR_EMAIL}"
|
|
- git config --global user.name "${DRONE_COMMIT_AUTHOR}"
|
|
- git clone https://gitea.frontblock.me/fb-dist/${DRONE_REPO_NAME}.git
|
|
- cp -r ./dist/* ./${DRONE_REPO_NAME}
|
|
- cp -r ./static ./${DRONE_REPO_NAME}
|
|
- cd ./${DRONE_REPO_NAME}
|
|
- git add -A
|
|
- git commit --allow-empty -m "drone tagged as version ${DRONE_TAG}"
|
|
- git tag ${DRONE_TAG}
|
|
- git push https://$GIT_USER:$GIT_PASSWORD@gitea.frontblock.me/fb-dist/${DRONE_REPO_NAME}.git master ${DRONE_TAG} --force
|
|
environment:
|
|
GIT_USER:
|
|
from_secret: git_user
|
|
GIT_PASSWORD:
|
|
from_secret: git_password
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
- name: deliver container
|
|
image: plugins/docker
|
|
settings:
|
|
registry: registry.frontblock.me
|
|
insecure: true
|
|
repo: registry.frontblock.me/vendor/admin
|
|
tags: ${DRONE_BUILD_CREATED}
|
|
|
|
- name: release container
|
|
image: plugins/docker
|
|
settings:
|
|
repo: frontblockme/admin
|
|
tags: ${DRONE_TAG}
|
|
username: frontblockme
|
|
password:
|
|
from_secret: docker_password
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
volumes:
|
|
- name: cache
|
|
host:
|
|
path: /tmp |