45 lines
No EOL
1.2 KiB
YAML
45 lines
No EOL
1.2 KiB
YAML
name: Deploy to Debian Server
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout the code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Build Docker image
|
|
run: |
|
|
docker build -t vaadin-app .
|
|
|
|
- name: Set up SSH
|
|
uses: webfactory/ssh-agent@v0.5.3
|
|
with:
|
|
ssh-private-key: ${{ secrets.SSH_KEY }}
|
|
|
|
- name: Deploy Docker image
|
|
run: |
|
|
ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF'
|
|
docker pull vaadin-app || true
|
|
docker stop vaadin-app || true
|
|
docker rm vaadin-app || true
|
|
docker run -d --name vaadin-app -p 8080:8080 \
|
|
-e DB_ADDRESS=${DB_ADDRESS} \
|
|
-e DB_USER=${DB_USER} \
|
|
-e DB_PASSWORD=${DB_PASSWORD} \
|
|
-e DB_NAME=${DB_NAME} \
|
|
vaadin-app
|
|
EOF
|
|
env:
|
|
DB_ADDRESS: ${{ secrets.DB_ADDRESS }}
|
|
DB_USER: ${{ secrets.DB_USER }}
|
|
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
|
DB_NAME: ${{ secrets.DB_NAME }} |