fix: Use tilde expansion and escape variables for remote execution
This commit is contained in:
parent
e8ef0710a2
commit
edffa1f249
@ -187,41 +187,40 @@ jobs:
|
||||
|
||||
- name: Deploy to CT109
|
||||
run: |
|
||||
export GITEA_TOKEN="${{ secrets.SECRET }}"
|
||||
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 }}"
|
||||
export GITEA_TOKEN="$GITEA_TOKEN"
|
||||
export GITEA_TOKEN="${{ secrets.SECRET }}"
|
||||
|
||||
# Use home directory for deployment
|
||||
DEPLOY_DIR="$HOME/littleshop"
|
||||
echo "Using deployment directory: $DEPLOY_DIR"
|
||||
DEPLOY_DIR=~/littleshop
|
||||
echo "Using deployment directory: \$DEPLOY_DIR"
|
||||
|
||||
# Create deployment directory if it doesn't exist
|
||||
mkdir -p "$DEPLOY_DIR"
|
||||
cd "$DEPLOY_DIR"
|
||||
mkdir -p "\$DEPLOY_DIR"
|
||||
cd "\$DEPLOY_DIR"
|
||||
|
||||
# Clone or pull latest code
|
||||
if [ ! -d .git ]; then
|
||||
echo "Cloning repository with authentication..."
|
||||
rm -rf * # Clean any existing files
|
||||
git clone https://oauth2:${GITEA_TOKEN}@git.silverlabs.uk/Jamie/littleshop.git .
|
||||
git clone https://oauth2:\${GITEA_TOKEN}@git.silverlabs.uk/Jamie/littleshop.git .
|
||||
else
|
||||
echo "Repository already cloned, pulling latest..."
|
||||
git fetch origin
|
||||
fi
|
||||
|
||||
echo "Checking out version: $VERSION"
|
||||
git checkout $VERSION || git checkout main
|
||||
echo "Checking out version: \$VERSION"
|
||||
git checkout \$VERSION || git checkout main
|
||||
|
||||
# Build images on CT109
|
||||
echo "Building LittleShop image..."
|
||||
docker build --no-cache -t littleshop:$VERSION .
|
||||
docker tag littleshop:$VERSION littleshop:latest
|
||||
docker build --no-cache -t littleshop:\$VERSION .
|
||||
docker tag littleshop:\$VERSION littleshop:latest
|
||||
|
||||
echo "Building TeleBot image..."
|
||||
docker build --no-cache -t telebot:$VERSION -f Dockerfile.telebot .
|
||||
docker tag telebot:$VERSION telebot:latest
|
||||
docker build --no-cache -t telebot:\$VERSION -f Dockerfile.telebot .
|
||||
docker tag telebot:\$VERSION telebot:latest
|
||||
|
||||
# Stop existing containers
|
||||
echo "Stopping existing containers..."
|
||||
|
||||
Loading…
Reference in New Issue
Block a user