Files
portal-api/.github/workflows/deploy.yml
T
2026-07-13 09:23:58 +07:00

55 lines
1.4 KiB
YAML

name: Deploy Portal API
on:
push:
branches:
- production
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.PORT }}
script_stop: true
script: |
set -ex
export PATH="$HOME/.phpenv/shims:$PATH"
php -v
BRANCH="production"
cd httpdocs
if test -d .git; then
echo "Updating source..."
git fetch origin
git reset --hard origin/$BRANCH
else
echo "First deploy..."
git clone -b "$BRANCH" "${{ secrets.REPO_URL }}" .
fi
rm -rf vendor
composer install --no-dev --optimize-autoloader --no-interaction
php artisan migrate --force
php artisan optimize
php artisan queue:restart || true
echo "Deploy completed."