Skip to content

refactor: Streamline A100 deployment workflow with direct git and doc… #5

refactor: Streamline A100 deployment workflow with direct git and doc…

refactor: Streamline A100 deployment workflow with direct git and doc… #5

Workflow file for this run

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 "DEPLOY_PATH='${DEPLOY_PATH}' bash -s" << 'EOF'
sudo chown -R $DEPLOY_USER:$DEPLOY_USER $DEPLOY_PATH
cd $DEPLOY_PATH
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