This commit is contained in:
commit
6a4fc2d151
21
.drone.yml
Normal file
21
.drone.yml
Normal file
@ -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
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
dist/
|
||||
.env
|
9
README.md
Normal file
9
README.md
Normal file
@ -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...)
|
15
compile.sh
Executable file
15
compile.sh
Executable file
@ -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
|
21
deploy.sh
Executable file
21
deploy.sh
Executable file
@ -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
|
5
gemini/build.sh
Executable file
5
gemini/build.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
cp -r ./public ../dist/public_gemini
|
||||
|
||||
echo "built gemini site!"
|
5
gemini/public/index.gmi
Normal file
5
gemini/public/index.gmi
Normal file
@ -0,0 +1,5 @@
|
||||
this is my gemini page.
|
||||
|
||||
there are many like it, but this one is mine.
|
||||
|
||||
=> / back to tilde.club
|
5
gopher/build.sh
Executable file
5
gopher/build.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
cp -r ./public ../dist/public_gopher
|
||||
|
||||
echo "finished building gopher site!"
|
7
gopher/public/public_gopher/gophermap
Normal file
7
gopher/public/public_gopher/gophermap
Normal file
@ -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 /
|
5
html/build.sh
Executable file
5
html/build.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
cp -r ./public ../dist/public_html
|
||||
|
||||
echo "finished building HTML"
|
3
html/public/index.php
Normal file
3
html/public/index.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
echo "hai :3"
|
||||
?>
|
Loading…
Reference in New Issue
Block a user