Jafner.net/homelab/stacks/deploy.sh

17 lines
722 B
Bash
Raw Normal View History

2024-09-02 13:21:23 -07:00
#!/bin/bash
# run me with
# curl https://gitea.jafner.tools/Jafner/Jafner.net/raw/branch/main/homelab/stacks/deploy.sh | bash
STACK=$1
mkdir -p /tmp/stack/$STACK
git clone -n --depth=1 --filter=tree:0 https://gitea.jafner.tools/Jafner/Jafner.net.git /tmp/stack/$STACK && cd /tmp/stack/$STACK
git sparse-checkout set --no-cone homelab/stacks/$STACK && git checkout
mv homelab/stacks/$STACK $HOME/stacks/
cd $HOME/stacks/$STACK && rm -rf /tmp/stack/$STACK
echo -e "$(cat $HOME/.age/$HOSTNAME.host.key)\n$AGE_DEPLOY_KEY" > $HOME/.age/combined.key
export SOPS_AGE_KEY_FILE="$HOME/.age/combined.key"
for file in $(find . -type f); do
sops decrypt -i --input-type json "$file" 2>/dev/null && echo "Decrypted $file"
done