fix: Simplify to use public HTTPS clone (no authentication needed)
All checks were successful
Build and Deploy LittleShop / Deploy to Production VPS (Manual Only) (push) Has been skipped
Build and Deploy LittleShop / Deploy to Pre-Production (CT109) (push) Successful in 1m2s

This commit is contained in:
SysAdmin 2025-11-17 14:07:12 +00:00
parent 1a7fd96486
commit 25ec371961

View File

@ -187,36 +187,10 @@ jobs:
- name: Deploy to CT109
run: |
# Copy SSH key to CT109 for git access
echo "Setting up git SSH access on CT109..."
scp -i ~/.ssh/deploy_key -P ${{ secrets.CT109_SSH_PORT }} ~/.ssh/deploy_key ${{ secrets.CT109_USER }}@${{ secrets.CT109_HOST }}:~/.ssh/git_deploy_key
ssh -i ~/.ssh/deploy_key -p ${{ secrets.CT109_SSH_PORT }} ${{ secrets.CT109_USER }}@${{ secrets.CT109_HOST }} bash -s << 'ENDSSH'
set -e
export VERSION="${{ github.sha }}"
# Configure SSH for git
chmod 600 ~/.ssh/git_deploy_key
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/git_deploy_key 2>/dev/null || true
# Try to determine Gitea SSH port (try common ports)
echo "Testing Gitea SSH connectivity..."
for port in 22 2222 2223 3000; do
if nc -z -w1 git.silverlabs.uk $port 2>/dev/null; then
echo "Found SSH service on port $port"
GITEA_SSH_PORT=$port
break
fi
done
# Default to 22 if not found
GITEA_SSH_PORT=${GITEA_SSH_PORT:-22}
echo "Using SSH port: $GITEA_SSH_PORT"
# Add git.silverlabs.uk to known hosts
ssh-keyscan -p $GITEA_SSH_PORT git.silverlabs.uk >> ~/.ssh/known_hosts 2>/dev/null || true
# Use home directory for deployment
DEPLOY_DIR=~/littleshop
echo "Using deployment directory: $DEPLOY_DIR"
@ -225,14 +199,14 @@ jobs:
mkdir -p "$DEPLOY_DIR"
cd "$DEPLOY_DIR"
# Clone or pull latest code via SSH
# Clone or pull latest code (public repository, no auth needed)
if [ ! -d .git ]; then
echo "Cloning repository via SSH..."
echo "Cloning repository from public HTTPS..."
rm -rf * # Clean any existing files
GIT_SSH_COMMAND="ssh -i ~/.ssh/git_deploy_key -p $GITEA_SSH_PORT" git clone ssh://git@git.silverlabs.uk:$GITEA_SSH_PORT/Jamie/littleshop.git .
git clone https://git.silverlabs.uk/Jamie/littleshop.git .
else
echo "Repository already cloned, pulling latest..."
GIT_SSH_COMMAND="ssh -i ~/.ssh/git_deploy_key -p $GITEA_SSH_PORT" git fetch origin
git fetch origin
fi
echo "Checking out version: $VERSION"