Minor cleanup and initial setup for staging env
Some checks failed
Remote Deployment Pipeline / Prepare deployment vars (pull_request) Successful in 2s
Remote Deployment Pipeline / Create remote directory (pull_request) Successful in 8s
Remote Deployment Pipeline / Cleanup MR environment (pull_request) Has been skipped
Remote Deployment Pipeline / Sync repository files (pull_request) Successful in 17s
Remote Deployment Pipeline / Run docker-compose remotely (Dev) (pull_request) Successful in 6s
Remote Deployment Pipeline / Run docker-compose remotely (Prod) (pull_request) Has been skipped
Remote Deployment Pipeline / Run docker-compose remotely (Staging) (pull_request) Failing after 7s
Some checks failed
Remote Deployment Pipeline / Prepare deployment vars (pull_request) Successful in 2s
Remote Deployment Pipeline / Create remote directory (pull_request) Successful in 8s
Remote Deployment Pipeline / Cleanup MR environment (pull_request) Has been skipped
Remote Deployment Pipeline / Sync repository files (pull_request) Successful in 17s
Remote Deployment Pipeline / Run docker-compose remotely (Dev) (pull_request) Successful in 6s
Remote Deployment Pipeline / Run docker-compose remotely (Prod) (pull_request) Has been skipped
Remote Deployment Pipeline / Run docker-compose remotely (Staging) (pull_request) Failing after 7s
This commit is contained in:
@@ -15,6 +15,8 @@ env:
|
||||
# Set the absolute path for your production deployment on the remote server.
|
||||
REMOTE_PROD_PATH: /var/app/traefik/prod
|
||||
|
||||
REMOTE_STAGING_PATH: /var/app/traefik/staging
|
||||
|
||||
SSH_HOST: ${{ secrets.SSH_HOST }}
|
||||
SSH_USER: ${{ secrets.SSH_USER }}
|
||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
@@ -114,6 +116,32 @@ jobs:
|
||||
|
||||
- name: Run docker-compose on remote host
|
||||
run: ssh -p "$SSH_PORT" $SSH_USER@$SSH_HOST "cd '${{ needs.prepare_deployment_vars.outputs.deploy_path }}' && docker-compose --env-file dev.env -f docker-compose.yaml up -d --build"
|
||||
|
||||
run_docker_compose_staging:
|
||||
name: Run docker-compose remotely (Staging)
|
||||
runs-on: ubuntu-latest
|
||||
needs: [sync_repo_files, prepare_deployment_vars]
|
||||
# if: |
|
||||
# (github.ref == 'refs/heads/main')
|
||||
steps:
|
||||
- name: Setup SSH
|
||||
uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd # v0.9.1
|
||||
with:
|
||||
ssh-private-key: ${{ env.SSH_PRIVATE_KEY }}
|
||||
|
||||
- name: Add host to known_hosts
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
ssh-keyscan -p "$SSH_PORT" -T 10 -H "$SSH_HOST" >> ~/.ssh/known_hosts 2>/dev/null || {
|
||||
echo "::error::Failed to ssh-keyscan $SSH_HOST:$SSH_PORT"
|
||||
exit 1
|
||||
}
|
||||
chmod 644 ~/.ssh/known_hosts
|
||||
|
||||
- name: Run docker-compose on remote host
|
||||
run: ssh -p "$SSH_PORT" $SSH_USER@$SSH_HOST "cd '${REMOTE_STAGING_PATH}' && docker-compose --env-file staging.env -f docker-compose.yaml up -d --build"
|
||||
|
||||
run_docker_compose_prod:
|
||||
name: Run docker-compose remotely (Prod)
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
Reference in New Issue
Block a user