fix(ci): decode base64 SSH key for deploy
Some checks failed
CI/CD Pipeline / Build Docker Images (push) Has been cancelled
CI/CD Pipeline / Push to Gitea Registry (push) Has been cancelled
CI/CD Pipeline / Deploy to Server (push) Has been cancelled
CI/CD Pipeline / Run Tests (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (push) Has been cancelled
Some checks failed
CI/CD Pipeline / Build Docker Images (push) Has been cancelled
CI/CD Pipeline / Push to Gitea Registry (push) Has been cancelled
CI/CD Pipeline / Deploy to Server (push) Has been cancelled
CI/CD Pipeline / Run Tests (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (push) Has been cancelled
This commit is contained in:
@@ -179,18 +179,18 @@ jobs:
|
||||
run: |
|
||||
BRANCH_TAG=$(echo ${GITHUB_REF_NAME} | sed 's/\//-/g')
|
||||
|
||||
# Setup SSH
|
||||
# Setup SSH (decode base64 key)
|
||||
mkdir -p ~/.ssh
|
||||
echo "${DEPLOY_SSH_KEY}" > ~/.ssh/deploy_key
|
||||
echo "${DEPLOY_SSH_KEY}" | base64 -d > ~/.ssh/deploy_key
|
||||
chmod 600 ~/.ssh/deploy_key
|
||||
ssh-keyscan -H ${DEPLOY_HOST} >> ~/.ssh/known_hosts 2>/dev/null
|
||||
|
||||
# Deploy commands
|
||||
ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=no ${DEPLOY_USER}@${DEPLOY_HOST} << EOF
|
||||
ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=no ${DEPLOY_USER}@${DEPLOY_HOST} "
|
||||
cd /opt/mostovik-backend
|
||||
|
||||
# Login to registry
|
||||
echo "${REGISTRY_PASSWORD}" | docker login --username "${REGISTRY_USER}" --password-stdin git.dev.nii-ecos.ru
|
||||
echo '${REGISTRY_PASSWORD}' | docker login --username '${REGISTRY_USER}' --password-stdin git.dev.nii-ecos.ru
|
||||
|
||||
# Pull new images
|
||||
export IMAGE_TAG=${BRANCH_TAG}
|
||||
@@ -201,7 +201,7 @@ jobs:
|
||||
|
||||
# Cleanup old images
|
||||
docker image prune -f
|
||||
EOF
|
||||
"
|
||||
|
||||
echo "Deployed ${BRANCH_TAG} to ${DEPLOY_HOST}"
|
||||
env:
|
||||
|
||||
Reference in New Issue
Block a user