Website/.drone-docker.yml
2021-10-27 20:15:27 -04:00

75 lines
1.8 KiB
YAML

kind: pipeline
type: docker
name: default
concurrency:
limit: 1
environment:
SPT_ITEMS_PATH: /var/www/html/aki/spt-item-api
trigger:
event:
- push
- promote
steps:
- name: fetch and update submodules to the latest commit
image: alpine/git
commands:
- git submodule init
- git submodule update --recursive --remote
- name: replace hosts and user variables
image: ubuntu:impish
environment:
DEPLOY_HOST:
from_secret: deploy_host
SPT_HOSTNAME:
from_secret: spt_hostname
DEPLOYMENT_USER:
from_secret: deploy_username
commands:
- sed -i 's/{{ SPT_HOSTNAME }}/'"$SPT_HOSTNAME"'/g' ./frontend/.env
- sed -i 's/{{ DEPLOY_HOST }}/'"$DEPLOY_HOST"'/g' ./.ansible/inventory
- sed -i 's/{{ DEPLOYMENT_USER }}/'"$DEPLOYMENT_USER"'/g' ./.ansible/inventory
- name: build frontend
image: node:lts-alpine3.14
commands:
- node -v
- npm -v
- yarn --version
- yarn --cwd ./frontend install
- yarn --cwd ./frontend build --pure-lockfile
- rm -rf ./api/public/static/*
- mv ./frontend/build/* ./api/public
- rm ./api/public/index.html
- name: check ansible syntax
image: plugins/ansible:3
settings:
playbook: ./.ansible/playbook.yml
inventory: ./.ansible/inventory
galaxy: ./.ansible/requirements.yml
syntax_check: true
- name: apply ansible playbook
image: plugins/ansible:3
settings:
playbook: ./.ansible/playbook.yml
inventory: ./.ansible/inventory
galaxy: ./.ansible/requirements.yml
private_key:
from_secret: deploy_ssh_key
environment:
DEPLOY_HOST:
from_secret: deploy_host
SPT_HOSTNAME:
from_secret: spt_hostname
DEPLOYMENT_USER:
from_secret: deploy_username
when:
event:
- promote
target:
- production