-
Notifications
You must be signed in to change notification settings - Fork 41
49 lines (48 loc) · 1.6 KB
/
hostinger-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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: |
npm run build
- 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: Install SSH key
run: |
mkdir -p ~/.ssh/
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -t rsa -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- 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