chore: Add debug logging to A100 deployment workflow #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Application | |
on: | |
push: | |
branches: | |
- feat/deploy-actions # TODO: Change to main later | |
pull_request: | |
types: | |
- closed | |
branches: | |
- feat/deploy-actions # TODO: Change to main later | |
jobs: | |
deploy: | |
if: github.event.pull_request.merged == true || github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup SSH Config | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts | |
chmod 600 ~/.ssh/known_hosts | |
- name: Setup SSH Key | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Deploy to A100 Instance | |
env: | |
HOST: ${{ secrets.A100_HOST_2 }} | |
DEPLOY_USER: ${{ secrets.A100_USER }} | |
DEPLOY_PATH: ${{ secrets.A100_DEPLOY_PATH }} | |
run: | | |
ssh -o StrictHostKeyChecking=no $DEPLOY_USER@$HOST << 'EOF' | |
# Debug information | |
echo "Current user: $(whoami)" | |
echo "Current directory: $(pwd)" | |
echo "DEPLOY_PATH: $DEPLOY_PATH" | |
echo "Listing current directory:" | |
ls -la | |
# Your other commands... | |
sudo mkdir -p $DEPLOY_PATH | |
echo "Listing DEPLOY_PATH directory:" | |
ls -la $DEPLOY_PATH | |
sudo chown -R $DEPLOY_USER:$DEPLOY_USER $DEPLOY_PATH | |
cd $DEPLOY_PATH | |
echo "After cd to DEPLOY_PATH:" | |
pwd | |
ls -la | |
sudo git stash | |
git fetch origin main | |
git reset --hard origin/main | |
docker compose -f docker-compose.yml build --no-cache | |
./docker-ctl down | |
sudo bash launch.sh | |
echo "Deployment completed at $(date)" | |
EOF | |
- name: Deployment Status | |
if: always() | |
run: | | |
if [ "${{ job.status }}" == "success" ]; then | |
echo "✅ Deployment successful to A100 Instance" | |
else | |
echo "❌ Deployment failed for A100 Instance" | |
fi |