Skip to content

Change in hostinger-deploy.yml #2

Change in hostinger-deploy.yml

Change in hostinger-deploy.yml #2

name: HostingerDeploy
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Copy .env
run: cp .env.example .env
- name: Install composer Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Install node dependencies
run: npm ci
- name: Setup Project
run: |
php artisan config:clear
php artisan cache:clear
php artisan key:generate
npm run build
- name: Directory Permissions
run: chmod 755 -R storage bootstrap/cache
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy PHP to Server
if: ${{ success() }}
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
port: ${{ secrets.SSH_PORT }}
key: ${{ secrets.SSH_KEY }}
script_stop: true
script: |
cd domains
cd laravel-space.com
git pull
php composer.phar install
php artisan migrate --force
- name: Copy Build Files to Target Server
run: |
rsync -r -e "ssh -p ${{ secrets.SSH_PORT }}" ${{ github.workspace }}/public/build/ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:~/domains/laravel-space.com/public/build
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }}