From e625dc30ad4b434545d9a2ef8344650b3e2d7800 Mon Sep 17 00:00:00 2001 From: Ryan Westfall Date: Sat, 27 Jun 2026 12:19:54 -0500 Subject: [PATCH] Updated to get gitea action runner --- .gitea/workflows/deploy.yml | 15 ++++++ .gitignore | 1 + .../public/templates/public/new_index.html | 53 +++++++++++++++++++ requirements.txt | 2 + scripts/deploy.sh | 36 +++++++++++++ 5 files changed, 107 insertions(+) create mode 100644 .gitea/workflows/deploy.yml create mode 100755 scripts/deploy.sh diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..a946b46 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,15 @@ +name: Deploy Company Site + +on: + push: + branches: [main] + +jobs: + deploy: + runs-on: self-hosted + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Deploy to live site + run: bash scripts/deploy.sh "${{ gitea.workspace }}" diff --git a/.gitignore b/.gitignore index 0dbf2f2..034972c 100644 --- a/.gitignore +++ b/.gitignore @@ -168,3 +168,4 @@ cython_debug/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ +.runner diff --git a/company_site/public/templates/public/new_index.html b/company_site/public/templates/public/new_index.html index 51376a2..e24fa2e 100644 --- a/company_site/public/templates/public/new_index.html +++ b/company_site/public/templates/public/new_index.html @@ -36,6 +36,59 @@ +{% if user.is_authenticated %} + +
+
+

Trusted By

+
+ +
+{% endif %} +
diff --git a/requirements.txt b/requirements.txt index f0264d0..580e5c2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,8 @@ Django==5.0 django-enum==2.1.0 django-phonenumber-field==8.0.0 django-recaptcha==4.0.0 +gunicorn==23.0.0 +psycopg2-binary==2.9.10 filelock==3.17.0 identify==2.6.9 nodeenv==1.9.1 diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 0000000..bcf855b --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +set -euo pipefail + +REPO_ROOT="/home/westfarn/Documents/django_live_sites/Company_Site" +APP_DIR="$REPO_ROOT/company_site" +VENV="$REPO_ROOT/venv" +SETTINGS="$APP_DIR/company_site/settings.py" +LOCAL_SETTINGS="$APP_DIR/company_site/local_settings.py" + +if [[ $# -lt 1 || -z "${1:-}" ]]; then + echo "Usage: $0 " >&2 + exit 1 +fi + +CHECKOUT="$1" + +cp "$SETTINGS" /tmp/company_site_settings.py.bak +cp "$LOCAL_SETTINGS" /tmp/company_site_local_settings.py.bak 2>/dev/null || true + +rsync -a --delete \ + --exclude venv/ \ + --exclude .git/ \ + --exclude 'company_site/company_site/settings.py' \ + --exclude 'company_site/company_site/local_settings.py' \ + "$CHECKOUT/" "$REPO_ROOT/" + +cp /tmp/company_site_settings.py.bak "$SETTINGS" +cp /tmp/company_site_local_settings.py.bak "$LOCAL_SETTINGS" 2>/dev/null || true + +source "$VENV/bin/activate" +pip install -r "$REPO_ROOT/requirements.txt" +cd "$APP_DIR" +python manage.py migrate --noinput +python manage.py collectstatic --noinput + +sudo systemctl restart company