Files
kngil_home/.gitea/workflows/deploy.yml
T

38 lines
843 B
YAML

name: Deploy (build on server)
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Deploy via SSH
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ vars.SSH_HOST }}
username: ${{ vars.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ vars.SSH_PORT }}
script: |
cd ${{ secrets.DEPLOY_PATH }}
cat << 'ENVEOF' > .env
${{ secrets.DEPLOY_ENV_FILE }}
ENVEOF
# Export variables from .env file
set -a
source .env
set +a
git fetch origin main
git checkout main
git pull --ff-only
docker compose --env-file .env up -d --build