apps.ad5001.eu/ci/drone.yml

114 lines
2.9 KiB
YAML
Raw Normal View History

2021-08-11 20:05:29 +00:00
---
2021-08-08 23:11:40 +00:00
kind: pipeline
name: default
clone:
git:
image: plugins/git
recursive: true
steps:
- name: Initilizing submodules
image: alpine/git
environment:
GIT_ASKPASS: "/bin/git-askpass-from-env"
commands:
2021-08-11 20:05:29 +00:00
# Installing little script to get git password from environment.
- wget https://download.ad5001.eu/other/git-askpass-from-env.sh
- mv git-askpass-from-env.sh /bin/git-askpass-from-env
- chmod +x /bin/git-askpass-from-env
# Changing submodule URL to https://<USERNAME>@git.ad5001.eu/Ad5001/omegamma.git
- git submodule init
- git config submodule.sub/omegamma.url https://$DRONE_GIT_USERNAME@git.ad5001.eu/Ad5001/omegamma.git
# Fetching submodules
- git submodule update --init --recursive
2021-08-08 23:11:40 +00:00
- name: Build dev.apps.ad5001.eu
image: xdevbase/hugo-builder:latest
commands:
- hugo --config ci/dev.config.yml
2021-08-08 23:11:40 +00:00
when:
2021-08-11 20:05:29 +00:00
event: [push, tag]
branch: [master]
2021-08-08 23:45:27 +00:00
- name: Remove old dev.apps.ad5001.eu
image: appleboy/drone-ssh
settings:
host:
from_secret: SSH_HOST
username:
from_secret: SSH_USERNAME
password:
from_secret: SSH_PASSWORD
envs:
2021-08-11 20:05:29 +00:00
- DEV_WWW_PATH
2021-08-08 23:45:27 +00:00
script:
2021-08-11 20:05:29 +00:00
- export DEV_WWW_PATH=$DEV_WWW_PATH
- cd "$DEV_WWW_PATH"
- rm -rf *
2021-08-08 23:45:27 +00:00
when:
2021-08-11 20:05:29 +00:00
event: [push, tag]
branch: [master]
2021-08-08 23:11:40 +00:00
- name: Deploy dev.apps.ad5001.eu
image: appleboy/drone-scp
settings:
host:
from_secret: SSH_HOST
username:
from_secret: SSH_USERNAME
password:
from_secret: SSH_PASSWORD
target:
from_secret: DEV_WWW_PATH
source: public/*
when:
2021-08-11 20:05:29 +00:00
event: [push, tag]
branch: [master]
2021-08-08 23:11:40 +00:00
- name: Build apps.ad5001.eu
image: xdevbase/hugo-builder:latest
commands:
- hugo
2021-08-08 23:11:40 +00:00
when:
2021-08-11 20:05:29 +00:00
event: [push, tag]
branch: [prod]
2021-08-08 23:45:27 +00:00
- name: Remove old apps.ad5001.eu
image: appleboy/drone-ssh
environment:
PROD_WWW_PATH:
from_secret: PROD_WWW_PATH
settings:
host:
from_secret: SSH_HOST
username:
from_secret: SSH_USERNAME
password:
from_secret: SSH_PASSWORD
envs:
2021-08-11 20:05:29 +00:00
- PROD_WWW_PATH
2021-08-08 23:45:27 +00:00
script:
2021-08-11 20:05:29 +00:00
- export DEV_WWW_PATH=$DEV_WWW_PATH
- cd "$PROD_WWW_PATH"
- rm -rf *
2021-08-08 23:45:27 +00:00
when:
2021-08-11 20:05:29 +00:00
event: [push, tag]
branch: [prod]
2021-08-08 23:11:40 +00:00
- name: Deploy apps.ad5001.eu
image: appleboy/drone-scp
settings:
host:
from_secret: SSH_HOST
username:
from_secret: SSH_USERNAME
password:
from_secret: SSH_PASSWORD
target:
from_secret: PROD_WWW_PATH
source: public/*
when:
2021-08-11 20:05:29 +00:00
event: [push, tag]
branch: [prod]