Skip to content

Commit

Permalink
feat: CD
Browse files Browse the repository at this point in the history
  • Loading branch information
almax07082005 committed Jul 29, 2024
1 parent c32f2ce commit 401eaba
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Continuous Deployment
on:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Authorize in Docker
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}

- name: Set up JDK 20
uses: actions/setup-java@v2
with:
java-version: '20'
distribution: 'adopt'

- name: Build JAR
run: ./gradlew bootJar

- name: Build Docker image
run: docker build --platform linux/amd64 -t almaxgood/cardio-bot:1.0.0 .

- name: Push Docker image
run: docker push almaxgood/cardio-bot:1.0.0

- name: Install sshpass
run: sudo apt install sshpass

- name: Run on VM
run: sshpass -p ${{ secrets.VM_PASSWORD }} ssh -o StrictHostKeyChecking=no root@${{ secrets.VM_IP }}
'cd ~/cardio-bot &&
docker compose down &&
docker system prune -a -f --volumes &&
docker compose up -d'

0 comments on commit 401eaba

Please sign in to comment.