add drone ci config
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
6e3e8c3451
commit
838db59663
|
@ -0,0 +1,38 @@
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: deploy
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: deploy
|
||||||
|
image: ubuntu
|
||||||
|
environment:
|
||||||
|
HOST:
|
||||||
|
from_secret: host
|
||||||
|
USER:
|
||||||
|
from_secret: user
|
||||||
|
SSH_KEY:
|
||||||
|
from_secret: ssh_key
|
||||||
|
SRC: content
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
|
||||||
|
commands:
|
||||||
|
# install stuff
|
||||||
|
- apt-get update -qq > /dev/null
|
||||||
|
- apt-get install ssh rsync -qq > /dev/null
|
||||||
|
|
||||||
|
# configure ssh identity by importing ssh key from secrets and adding it to
|
||||||
|
# ssh-agent. also disable strict host key checking as this is the first time
|
||||||
|
# the ephemeral runner is connecting to the remote host
|
||||||
|
- which ssh-agent
|
||||||
|
- eval $(ssh-agent -s)
|
||||||
|
- mkdir -p ~/.ssh
|
||||||
|
- echo "$SSH_KEY" > ~/.ssh/id_rsa
|
||||||
|
- chmod 600 ~/.ssh/id_rsa
|
||||||
|
- ssh-add
|
||||||
|
- echo "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
|
||||||
|
|
||||||
|
# run operations on the remote host
|
||||||
|
- ssh "$${USER}@$${HOST}" "[[ ! -d ~/gemini/content ]] || rm -r ~/gemini/content"
|
||||||
|
- rsync -rP content "$${USER}@$${HOST}:gemini"
|
20
deploy.sh
20
deploy.sh
|
@ -1,20 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
site=period3.xyz
|
|
||||||
gemini=/home/gemini/gemini
|
|
||||||
dest="$gemini/content"
|
|
||||||
|
|
||||||
# remove existing files
|
|
||||||
sudo rm -rv $dest
|
|
||||||
|
|
||||||
# copy received files to hosting location
|
|
||||||
sudo mv $site $dest
|
|
||||||
sudo chown -R gemini:gemini $dest
|
|
||||||
|
|
||||||
# delete self
|
|
||||||
rm -v deploy.sh
|
|
||||||
|
|
||||||
printf "\ndone!\n"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
21
makefile
21
makefile
|
@ -1,21 +0,0 @@
|
||||||
.DEFAULT_GOAL := $(SITE)
|
|
||||||
|
|
||||||
SITE = period3.xyz
|
|
||||||
|
|
||||||
HOST = pluto
|
|
||||||
HOST_DIR = $(HOST):~
|
|
||||||
|
|
||||||
CONTENT = content/
|
|
||||||
DEPLOY = deploy.sh
|
|
||||||
|
|
||||||
# to deploy the site we copy a deploy script and the site
|
|
||||||
# contents over to the remote host, then run the deploy script
|
|
||||||
# which is used to place the site files in the hosted root folder
|
|
||||||
# we then delete the built site directory locally to avoid accidentally
|
|
||||||
# caching stuff for future deploys
|
|
||||||
deploy: $(CONTENT)
|
|
||||||
rsync -rP $(CONTENT) $(SITE)
|
|
||||||
rsync -P $(DEPLOY) $(HOST_DIR)
|
|
||||||
rsync -rP $(SITE) $(HOST_DIR)
|
|
||||||
ssh $(HOST) "bash -s" < $(DEPLOY)
|
|
||||||
rm -r $(SITE)
|
|
Loading…
Reference in New Issue