Files
GMW/.github/workflows/deploy.yml
T

43 lines
1.3 KiB
YAML

name: Deploy to VPS
on:
push:
branches:
- master
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Copy Files to VPS
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USERNAME }}
key: ${{ secrets.VPS_SSH_KEY }}
source: ".,!**/node_modules,!**/node_modules/**,!**/.git,!**/.git/**,!node_modules,!vendor/discord.js-selfbot-v13/node_modules,!.git,!vendor/discord.js-selfbot-v13/.git,!.github,!.github/**,!recordings,!recordings/**,!dist,!dist/**,!.env,!*.db,!*.db-shm,!*.db-wal,!test_out.nut"
target: "/opt/imphenbot"
rm: false
- name: Deploy via SSH
uses: appleboy/ssh-action@v1.0.3
env:
ENV_FILE: ${{ secrets.ENV_FILE }}
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USERNAME }}
key: ${{ secrets.VPS_SSH_KEY }}
envs: ENV_FILE
script: |
cd /opt/imphenbot || exit
# Write environment variables from GitHub Secrets
echo "$ENV_FILE" > .env
# Build and restart containers
docker-compose up -d --build