Skip to content

update README.md

update README.md #10

Workflow file for this run

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:${{ vars.DOCKER_TAG }} .
- name: Push Docker image
run: docker push almaxgood/cardio-bot:${{ vars.DOCKER_TAG }}
- name: Install sshpass
run: sudo apt install sshpass
- name: Compose .env file
run: |
echo POSTGRES_USER=${{ secrets.POSTGRES_USER }}>>.env
echo POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}>>.env
echo MAIN_TOKEN=${{ secrets.MAIN_TOKEN }}>>.env
echo LOGGER_TOKEN=${{ secrets.LOGGER_TOKEN }}>>.env
echo GUIDE=${{ secrets.GUIDE }}>>.env
echo DOCKER_TAG=${{ vars.DOCKER_TAG }}>>.env
- name: Copy .env file to VM
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.VM_IP }}
username: root
password: ${{ secrets.VM_PASSWORD }}
source: ./.env
target: ~/cardio-bot
- 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'