2024-09-06 19:08:49 +00:00
|
|
|
name: Deploy Vaadin App
|
2024-09-06 17:41:47 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2024-09-06 19:08:49 +00:00
|
|
|
- main # Adjust this to your deployment branch
|
2024-09-06 17:41:47 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
deploy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2024-09-06 19:08:49 +00:00
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v3
|
2024-09-06 17:41:47 +00:00
|
|
|
|
2024-09-06 19:08:49 +00:00
|
|
|
- name: Build JAR
|
|
|
|
run: ./mvnw clean package -DskipTests
|
2024-09-06 17:41:47 +00:00
|
|
|
|
2024-09-06 19:08:49 +00:00
|
|
|
- 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
|
2024-09-06 17:41:47 +00:00
|
|
|
|
2024-09-06 19:08:49 +00:00
|
|
|
- name: Upload Dockerfile to server
|
|
|
|
run: scp -i ${{ secrets.SSH_KEY }} Dockerfile ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/home/${{ secrets.SSH_USER }}/munera
|
2024-09-06 17:48:36 +00:00
|
|
|
|
2024-09-06 19:08:49 +00:00
|
|
|
- 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
|
2024-09-06 18:30:32 +00:00
|
|
|
|
2024-09-06 19:08:49 +00:00
|
|
|
- name: Deploy on server
|
2024-09-06 17:48:36 +00:00
|
|
|
run: |
|
2024-09-06 19:08:49 +00:00
|
|
|
ssh -i ${{ secrets.SSH_KEY }} ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF'
|
2024-09-06 18:47:43 +00:00
|
|
|
cd /home/${{ secrets.SSH_USER }}/munera
|
2024-09-06 19:08:49 +00:00
|
|
|
docker-compose down
|
|
|
|
docker-compose up --build -d
|
|
|
|
EOF
|