Skip to content

deploy

deploy #51

Workflow file for this run

name: Docker Deploy
on:
repository_dispatch:
types: [deploy]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Upload to VPS
uses: appleboy/scp-action@master
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
port: ${{ secrets.VPS_PORT }}
source: ./deploy
target: ${{ secrets.VPS_WORK_DIR }}
- name: Execute deployment via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
port: ${{ secrets.VPS_PORT }}
envs: REPO_NAME
script: |
cd ${{ secrets.VPS_WORK_DIR }}/deploy
export $(grep -v '^#' ~/.env.local | xargs)
docker compose pull ${{ github.event.client_payload.app }}
docker compose up -d ${{ github.event.client_payload.app }}
docker image prune -f