Skip to content

trenc is deploying to Kali... #4

trenc is deploying to Kali...

trenc is deploying to Kali... #4

Workflow file for this run

name: Deploy to Kali
run-name: ${{ github.actor }} is deploying to Kali...
on:
workflow_dispatch:
release:
types: [published]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Trigger remote Git checkout and deploy
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
script: |
set -e
REPO_URL=git@github.com:Facts-and-Files/beszel.git
TARGET_DIR=~/beszel
echo "Checking repo at $TARGET_DIR..."
if [ -d "$TARGET_DIR/.git" ]; then
echo "Repository exists. Pulling latest changes..."
git -C "$TARGET_DIR" fetch --all
git -C "$TARGET_DIR" reset --hard origin/main
else
echo "Repository not found. Cloning..."
git clone "$REPO_URL" "$TARGET_DIR"
fi
echo "Populating .env file for Docker Compose..."
cat <<EOF > $TARGET_DIR/.env
TOKEN=${{ secrets.BESZEL_TOKEN }}
KEY=${{ secrets.BESZEL_KEY }}
HUB_URL=${{ secrets.BESZEL_HUB_URL }}
EOF
echo "Environment file written to $TARGET_DIR/.env"
echo "Docker updating service..."
cd "$TARGET_DIR"
docker compose pull || true
docker compose up -d --no-deps beszel beszel-agent
echo "Deployment complete."