-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c32f2ce
commit 401eaba
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
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
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' |