fix: Auto-detect Gitea SSH port instead of hardcoding 2223
This commit is contained in:
parent
e7659a4615
commit
1a7fd96486
@ -200,8 +200,22 @@ jobs:
|
||||
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 2223 git.silverlabs.uk >> ~/.ssh/known_hosts 2>/dev/null || true
|
||||
ssh-keyscan -p $GITEA_SSH_PORT git.silverlabs.uk >> ~/.ssh/known_hosts 2>/dev/null || true
|
||||
|
||||
# Use home directory for deployment
|
||||
DEPLOY_DIR=~/littleshop
|
||||
@ -215,10 +229,10 @@ jobs:
|
||||
if [ ! -d .git ]; then
|
||||
echo "Cloning repository via SSH..."
|
||||
rm -rf * # Clean any existing files
|
||||
GIT_SSH_COMMAND="ssh -i ~/.ssh/git_deploy_key -p 2223" git clone ssh://git@git.silverlabs.uk:2223/Jamie/littleshop.git .
|
||||
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 .
|
||||
else
|
||||
echo "Repository already cloned, pulling latest..."
|
||||
GIT_SSH_COMMAND="ssh -i ~/.ssh/git_deploy_key -p 2223" git fetch origin
|
||||
GIT_SSH_COMMAND="ssh -i ~/.ssh/git_deploy_key -p $GITEA_SSH_PORT" git fetch origin
|
||||
fi
|
||||
|
||||
echo "Checking out version: $VERSION"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user