Skip to content

Commit

Permalink
Create first version of CD yml
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodeholic committed Dec 22, 2023
1 parent 1bd5fbf commit 978125d
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/hostinger-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
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_PRIVATE_KEY }}

0 comments on commit 978125d

Please sign in to comment.