Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- name: Deploy
- on:
- push:
- branches:
- - main
- jobs:
- Production:
- name: Deploy to DigitalOcean
- runs-on: ubuntu-latest
- environment: Production
- steps:
- - uses: actions/checkout@v3
- - name: Build & Deploy
- env:
- SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
- SSH_HOST: ${{secrets.SSH_HOST}}
- USER_NAME: ${{secrets.USER_NAME}}
- run: |
- echo "Deploying to EC2"
- echo "${{ secrets.SSH_PRIVATE_KEY }}" > private_key && chmod 600 private_key
- ssh -o StrictHostKeyChecking=no -i private_key ${{ secrets.USER_NAME }}@${{ secrets.SSH_HOST }} '
- cd /root/learning-journey &&
- git reset --hard &&
- git checkout main &&
- git pull origin main &&
- docker-compose down &&
- docker-compose rm -fsv &&
- docker-compose up --build -d
- '
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement