munera-vaadin/.github/workflows/deploy.yml
2024-09-06 21:15:47 +02:00

40 lines
1.2 KiB
YAML

name: Deploy Vaadin App
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 22
uses: actions/setup-java@v3
with:
java-version: '22'
distribution: 'adopt-openjdk'
- name: Build JAR
run: ./mvnw clean package -DskipTests
- name: Upload JAR to server
run: scp -i ${{ secrets.SSH_KEY }} target/munera-1.0-SNAPSHOT.jar ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/home/${{ secrets.SSH_USER }}/munera
- name: Upload Dockerfile to server
run: scp -i ${{ secrets.SSH_KEY }} Dockerfile ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/home/${{ secrets.SSH_USER }}/munera
- name: Upload docker-compose.yml to server
run: scp -i ${{ secrets.SSH_KEY }} docker-compose.yml ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/home/${{ secrets.SSH_USER }}/munera
- name: Deploy on server
run: |
ssh -i ${{ secrets.SSH_KEY }} ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF'
cd /home/${{ secrets.SSH_USER }}/munera
docker-compose down
docker-compose up --build -d
EOF