Website/.drone-docker.yml

96 lines
2.4 KiB
YAML
Raw Normal View History

kind: pipeline
2021-10-30 16:40:30 +00:00
type: docker
2022-05-28 23:44:16 -04:00
name: website deployment
trigger:
event:
- push
steps:
- name: replace hosts and user variables
image: ubuntu:impish
environment:
DEPLOY_HOSTNAME:
from_secret: deploy_hostname
DEPLOY_USER:
from_secret: deploy_username
DEPLOY_PRIVATE_KEY:
from_secret: deploy_ssh_key
DEPLOY_SSH_KEY_PASSPHRASE:
from_secret: deploy_ssh_key_passphrase
commands:
- echo "$DEPLOY_PRIVATE_KEY" > private.key && chmod 600 private.key
2022-05-28 23:44:16 -04:00
- sed -i 's/{{ DEPLOY_HOSTNAME }}/'"$DEPLOY_HOSTNAME"'/g' ./.ansible/inventory
- sed -i 's/{{ DEPLOY_SSH_KEY_PASSPHRASE }}/'"$DEPLOY_SSH_KEY_PASSPHRASE"'/g' ./.ansible/inventory
- sed -i 's/{{ DEPLOY_USER }}/'"$DEPLOY_USER"'/g' ./.ansible/inventory
2022-05-06 21:49:53 -04:00
when:
branch:
2022-05-28 23:44:16 -04:00
- master
2022-05-06 21:49:53 -04:00
- development
2022-05-28 23:44:16 -04:00
- main
- develop
2022-05-06 21:49:53 -04:00
2022-05-28 23:44:16 -04:00
- name: check website ansible syntax
image: plugins/ansible:3
settings:
2022-05-28 23:44:16 -04:00
playbook: ./.ansible/playbook.yml
inventory: ./.ansible/inventory
syntax_check: true
2021-11-14 15:43:50 -05:00
depends_on:
2022-05-28 23:44:16 -04:00
- replace hosts and user variables
when:
branch:
- master
2022-05-28 23:44:16 -04:00
- development
2022-05-06 21:49:53 -04:00
- main
2022-05-28 23:44:16 -04:00
- develop
2022-05-06 21:49:53 -04:00
2022-05-28 23:44:16 -04:00
- name: dry-run ansible playbook website
2022-05-06 21:49:53 -04:00
image: plugins/ansible:3
settings:
2022-05-28 23:44:16 -04:00
playbook: ./.ansible/playbook.yml
inventory: ./.ansible/inventory
2022-05-06 21:49:53 -04:00
timeout: 60
verbose: 3
2022-05-06 21:49:53 -04:00
check: true
environment:
DEPLOY_HOSTNAME:
from_secret: deploy_hostname
DEPLOY_USER:
from_secret: deploy_username
DEPLOY_USER_GROUP:
from_secret: deploy_user_group
SPT_WEBSITE_PATH:
from_secret: website_deploy_path
2022-05-28 23:44:16 -04:00
depends_on:
- check website ansible syntax
when:
branch:
- master
- development
- main
- develop
2022-05-06 21:49:53 -04:00
- name: apply ansible playbook website
image: plugins/ansible:3
settings:
2022-05-28 23:44:16 -04:00
playbook: ./.ansible/playbook.yml
inventory: ./.ansible/inventory
2022-05-06 21:49:53 -04:00
timeout: 60
verbose: 2
environment:
DEPLOY_HOSTNAME:
from_secret: deploy_hostname
DEPLOY_USER:
from_secret: deploy_username
DEPLOY_USER_GROUP:
from_secret: deploy_user_group
SPT_WEBSITE_PATH:
from_secret: website_deploy_path
2022-05-28 23:44:16 -04:00
depends_on:
- check website ansible syntax
when:
branch:
- master
- main