summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-03-09 00:25:48 -0700
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-03-09 14:35:46 -0700
commit6a4fc2d15141cd922327267e376302f65a3bb277 (patch)
tree1e9e7db386433021813f4099f154803ce10af363
downloadtilde.club-6a4fc2d15141cd922327267e376302f65a3bb277.tar.gz
tilde.club-6a4fc2d15141cd922327267e376302f65a3bb277.zip
rsync
-rw-r--r--.drone.yml21
-rw-r--r--.gitignore2
-rw-r--r--README.md9
-rwxr-xr-xcompile.sh15
-rwxr-xr-xdeploy.sh21
-rwxr-xr-xgemini/build.sh5
-rw-r--r--gemini/public/index.gmi5
-rwxr-xr-xgopher/build.sh5
-rw-r--r--gopher/public/public_gopher/gophermap7
-rwxr-xr-xhtml/build.sh5
-rw-r--r--html/public/index.php3
11 files changed, 98 insertions, 0 deletions
diff --git a/.drone.yml b/.drone.yml
new file mode 100644
index 0000000..e821334
--- /dev/null
+++ b/.drone.yml
@@ -0,0 +1,21 @@
+---
+kind: pipeline
+type: docker
+name: default
+
+steps:
+- name: build
+ image: alpine
+ commands:
+ - sh compile.sh
+ - apk add rsync openssh
+ - sh deploy.sh
+ environment:
+ RSYNC_DESTINATION:
+ from_secret: RSYNC_DESTINATION
+ SSH_KEY:
+ from_secret: SSH_KEY
+
+trigger:
+ branch:
+ - main
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..51eb69f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+dist/
+.env
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e42f443
--- /dev/null
+++ b/README.md
@@ -0,0 +1,9 @@
+very simple CI/CD setup for my [tilde.club](https://tilde.club/~simponic)
+
+instructions:
+
+1. generate a new ssh key with no password (i.e. @ /tmp/id_ed25519)
+2. add the key to .ssh/authorized_keys @ tilde.club
+3. set RSYNC_DESTINATION in drone.io worker secrets to "<username>@tilde.club:/home/<username>"
+4. set SSH_KEY to (echo /tmp/id_ed25519 | base64 -e --wrap=0)
+5. profit (keep it simple! don't want env vars leaking for obvious reasons...)
diff --git a/compile.sh b/compile.sh
new file mode 100755
index 0000000..46ae743
--- /dev/null
+++ b/compile.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+mkdir -p dist
+
+pwd=$PWD
+
+for source in "html" "gemini" "gopher"; do
+ cd $source
+ echo "building $source..."
+ ./build.sh
+
+ cd $pwd
+done
diff --git a/deploy.sh b/deploy.sh
new file mode 100755
index 0000000..0799a23
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -e
+
+echo $SSH_KEY | base64 -d >> /tmp/key
+chmod -R 0600 /tmp/key
+
+for item in dist/*; do
+ echo "copying $item"
+ if [ -d "$item" ]; then
+ SOURCE_PATH="$item/"
+ DEST_PATH="$RSYNC_DESTINATION/$item/"
+ else
+ SOURCE_PATH="$item"
+ DEST_PATH="$RSYNC_DESTINATION"
+ fi
+ rsync -e "ssh -i /tmp/key -o StrictHostKeyChecking=no" -avz --delete $SOURCE_PATH $DEST_PATH
+done
+echo "finished copying to remote host..."
+
+rm /tmp/key
diff --git a/gemini/build.sh b/gemini/build.sh
new file mode 100755
index 0000000..f9366fa
--- /dev/null
+++ b/gemini/build.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+cp -r ./public ../dist/public_gemini
+
+echo "built gemini site!"
diff --git a/gemini/public/index.gmi b/gemini/public/index.gmi
new file mode 100644
index 0000000..98fb94c
--- /dev/null
+++ b/gemini/public/index.gmi
@@ -0,0 +1,5 @@
+this is my gemini page.
+
+there are many like it, but this one is mine.
+
+=> / back to tilde.club
diff --git a/gopher/build.sh b/gopher/build.sh
new file mode 100755
index 0000000..917ef64
--- /dev/null
+++ b/gopher/build.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+cp -r ./public ../dist/public_gopher
+
+echo "finished building gopher site!"
diff --git a/gopher/public/public_gopher/gophermap b/gopher/public/public_gopher/gophermap
new file mode 100644
index 0000000..97a4f13
--- /dev/null
+++ b/gopher/public/public_gopher/gophermap
@@ -0,0 +1,7 @@
+=/usr/bin/figlet -f slant "~"$(stat -c '%U' `pwd`)
+
+this is my gopher page.
+
+there are many like it, but this one is mine.
+
+1back to tilde.club /
diff --git a/html/build.sh b/html/build.sh
new file mode 100755
index 0000000..722e1d3
--- /dev/null
+++ b/html/build.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+cp -r ./public ../dist/public_html
+
+echo "finished building HTML"
diff --git a/html/public/index.php b/html/public/index.php
new file mode 100644
index 0000000..eee4f27
--- /dev/null
+++ b/html/public/index.php
@@ -0,0 +1,3 @@
+<?php
+echo "hai :3"
+?>