Skip to content

Configure deployment workflow #2

Configure deployment workflow

Configure deployment workflow #2

Workflow file for this run

name: Deploy to VPS
on:
push:
branches: [master]
paths:
- "backend/**"
- docker-compose.yml
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Deploy to VPS
id: deploy
uses: appleboy/[email protected]
with:
host: 159.89.180.105
username: ege
key: ${{ secrets.VPS_SSH_KEY }}
script: |
cd blog
docker compose down
git pull origin master
docker compose up --build -d
- name: Send success notification
if: success()
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.resend.com
server_port: 465
secure: true
username: resend
password: ${{ secrets.RESEND_API_KEY }}
subject: "Deployment Successful - ${{ github.repository }}"
to: ${{ secrets.NOTIFICATION_EMAIL }}
from: '"Deployments" <[email protected]>'
body: |
Deployment successful for ${{ github.repository }}
Branch: ${{ github.ref }}
Commit: ${{ github.sha }}
Author: ${{ github.actor }}
Time: ${{ github.event.head_commit.timestamp }}
- name: Send failure notification
if: failure()
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.resend.com
server_port: 465
secure: true
username: resend
password: ${{ secrets.RESEND_API_KEY }}
subject: "Deployment Failed - ${{ github.repository }}"
to: ${{ secrets.NOTIFICATION_EMAIL }}
from: '"Deployments" <[email protected]>'
body: |
Deployment failed for ${{ github.repository }}
Branch: ${{ github.ref }}
Commit: ${{ github.sha }}
Author: ${{ github.actor }}
Time: ${{ github.event.head_commit.timestamp }}
Error logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}