forked from mtusi2026/mtusi2026lab2
41 lines
1.0 KiB
YAML
41 lines
1.0 KiB
YAML
name: Deploy production
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
concurrency:
|
|
group: production
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Deploy to server
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Deploy
|
|
uses: appleboy/ssh-action@master
|
|
with:
|
|
host: ${{ secrets.DEPLOY_HOST }}
|
|
username: ${{ secrets.DEPLOY_USER }}
|
|
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
|
script: |
|
|
cd ~/mtusi2026lab2
|
|
git fetch origin main
|
|
git reset --hard origin/main
|
|
git clean -fd
|
|
docker compose down
|
|
docker compose build
|
|
docker compose up -d --wait --wait-timeout 120
|
|
|
|
- name: Verify deployment
|
|
uses: appleboy/ssh-action@master
|
|
with:
|
|
host: ${{ secrets.DEPLOY_HOST }}
|
|
username: ${{ secrets.DEPLOY_USER }}
|
|
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
|
script: |
|
|
cd ~/mtusi2026lab2
|
|
git log --oneline -3
|
|
docker compose ps
|