From 63a26b69b7100640f350c5c1a6d22a2ba22cf009 Mon Sep 17 00:00:00 2001
From: Brooke <brooke@myco.systems>
Date: Sat, 9 Mar 2024 17:26:34 -0500
Subject: [PATCH] update

---
 .gitea/workflows/deploy.yaml | 42 +++++++++++++++---------------------
 bin/test_static_page.sh      |  6 +++---
 2 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml
index 004aff8..8ff249b 100644
--- a/.gitea/workflows/deploy.yaml
+++ b/.gitea/workflows/deploy.yaml
@@ -1,34 +1,26 @@
 name: Hugo
 
-on: [push]
+on:
+  push:
+    branches:
+      - main
 
 jobs:
   build:
-
-    runs-on: ubuntu-22.04
-
+    runs-on: hugo-latest
     steps:
-    - uses: actions/checkout@v3
-      with:
-        submodules: 'recursive'
-    - name: Add key
-      run: |
-        mkdir $HOME/.ssh && \
-        echo "${{ secrets.SSH_PRIVATE_KEY }}" > $HOME/.ssh/id_rsa
-    - name: Grab packages
-      run: |
-        apt-get update && \
-        apt-get install -y jq rsync tar wget && \
-        wget https://github.com/gohugoio/hugo/releases/download/v0.123.6/hugo_extended_0.123.6_linux-amd64.tar.gz && \
-        tar -xzvf hugo_extended_0.123.6_linux-amd64.tar.gz && \
-        chmod +x hugo    
-    - name: Run build task
-      run: ./hugo --minify --logLevel info
-    - name: Test static page
-      run: bash ${{ gitea.workspace }}/bin/test_static_page.sh
-    - name: Deploy to Server
-      uses: easingthemes/ssh-deploy@main
-      env:
+      - name: Grab packages
+        run: apk add rsync openssh-client
+      - uses: actions/checkout@v4
+        with:
+          submodules: 'true'
+      - name: Run build task
+        run: hugo --minify
+      - name: Test static page
+        run: bash ${{ gitea.workspace }}/bin/test_static_page.sh
+      - name: Deploy to Server
+        uses: easingthemes/ssh-deploy@main
+        env:
           SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
           ARGS: "-rlgoDzvc -i --delete"
           SOURCE: "public/"
diff --git a/bin/test_static_page.sh b/bin/test_static_page.sh
index 14f4c97..efa9881 100644
--- a/bin/test_static_page.sh
+++ b/bin/test_static_page.sh
@@ -1,14 +1,14 @@
 #!/bin/bash
-PORT=8080
-python3 -m http.server $PORT --directory public/ &
 
+PORT=21300
+python3 -m http.server $PORT --directory public/ &
 SERVER_PID=$!
 
 # Give it a moment to start
 sleep 2
 
 # Check if the server is running
-if ! ps -p $SERVER_PID > /dev/null; then
+if [ ! -d "/proc/$SERVER_PID" ]; then
     echo "HTTP server failed to start."
     exit 1
 fi