Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
name: build and push image
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
version: ${{ steps.meta.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v6
Expand Down Expand Up @@ -64,4 +66,47 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
provenance: false

deploy:
name: deploy to VPS
needs: release
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Copy compose file to VPS
uses: appleboy/scp-action@v1
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
port: ${{ secrets.VPS_PORT || 22 }}
source: "docker/docker-compose.prod.yaml"
target: "${{ secrets.VPS_DEPLOY_PATH }}/"
strip_components: 1

- name: Deploy via SSH
uses: appleboy/ssh-action@v1
env:
BOT_IMAGE: ${{ env.IMAGE_NAME }}:${{ needs.release.outputs.version }}
DEPLOY_PATH: ${{ secrets.VPS_DEPLOY_PATH }}
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
port: ${{ secrets.VPS_PORT || 22 }}
envs: BOT_IMAGE,DEPLOY_PATH
script: |
set -euo pipefail
cd "$DEPLOY_PATH"

echo "Deploying image: $BOT_IMAGE"

docker compose -f docker-compose.prod.yaml pull
docker compose -f docker-compose.prod.yaml up -d --remove-orphans

docker compose -f docker-compose.prod.yaml ps
docker image prune -f