fix(ci): use scp to copy compose file to server
All checks were successful
CI/CD Pipeline / Code Quality Checks (push) Successful in 1m53s
CI/CD Pipeline / Run Tests (push) Successful in 2m0s
CI/CD Pipeline / Build Docker Images (push) Successful in 2s
CI/CD Pipeline / Push to Gitea Registry (push) Successful in 18s
CI/CD Pipeline / Deploy to Server (push) Successful in 30s
All checks were successful
CI/CD Pipeline / Code Quality Checks (push) Successful in 1m53s
CI/CD Pipeline / Run Tests (push) Successful in 2m0s
CI/CD Pipeline / Build Docker Images (push) Successful in 2s
CI/CD Pipeline / Push to Gitea Registry (push) Successful in 18s
CI/CD Pipeline / Deploy to Server (push) Successful in 30s
This commit is contained in:
@@ -175,6 +175,12 @@ jobs:
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/dev'
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
run: |
|
||||
REPO_URL=$(echo ${GITHUB_SERVER_URL} | sed "s|://|://oauth2:${{ gitea.token }}@|")
|
||||
git clone --depth=1 --branch=${GITHUB_REF_NAME} ${REPO_URL}/${GITHUB_REPOSITORY}.git .
|
||||
git checkout ${GITHUB_SHA}
|
||||
|
||||
- name: Deploy via SSH
|
||||
run: |
|
||||
BRANCH_TAG=$(echo ${GITHUB_REF_NAME} | sed 's/\//-/g')
|
||||
@@ -185,13 +191,13 @@ jobs:
|
||||
chmod 600 ~/.ssh/deploy_key
|
||||
ssh-keyscan -H ${DEPLOY_HOST} >> ~/.ssh/known_hosts 2>/dev/null
|
||||
|
||||
# Copy docker-compose.prod.yml to server
|
||||
scp -i ~/.ssh/deploy_key -o StrictHostKeyChecking=no docker-compose.prod.yml ${DEPLOY_USER}@${DEPLOY_HOST}:/opt/mostovik-backend/
|
||||
|
||||
# Deploy commands
|
||||
ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=no ${DEPLOY_USER}@${DEPLOY_HOST} "
|
||||
cd /opt/mostovik-backend
|
||||
|
||||
# Update docker-compose.prod.yml from repo
|
||||
curl -sf -o docker-compose.prod.yml http://10.10.0.10:3000/avm/mostovik-backend/raw/branch/${BRANCH_TAG}/docker-compose.prod.yml || echo 'Failed to fetch compose file'
|
||||
|
||||
# Login to registry (HTTP on internal IP)
|
||||
echo '${REGISTRY_PASSWORD}' | docker login --username '${REGISTRY_USER}' --password-stdin 10.10.0.10:3000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user