Deploy my laravel project to shared hosting with github actions

Viewed 541

please I added GitHub action main.yml to my Laravel project to the shared hosting for automated deployment. The deployment worked okay but the project was placed outside public_html because of the path I specified - server_dir: /home5/app/public_html/, I want the project files to be put into the public_html folder. Below is the code:

name: Glory Deploy Production
on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
jobs:
  web-deploy:
    name: Deploying...
    runs-on: ubuntu-latest
    steps:
    - uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
      with:
        php-version: '8.0'
    - uses: actions/checkout@v2.3.2
    - name: Copy .env
      run: php -r "file_exists('.env') || copy('.env.example', '.env');"
    - name: Install Dependencies
      run: composer update --ignore-platform-reqs
    - name: Generate key
      run: php artisan key:generate
    - name: Directory Permissions
      run: chmod -R 777 storage bootstrap/cache
    - name:  Sync files
      uses: SamKirkland/FTP-Deploy-Action@4.0.0
      with:
        server: ${{ secrets.server }}
        username: ${{ secrets.username}}
        password: ${{ secrets.password}}
        server_dir: /home5/app/public_html/

Please can I modify the path pointing to the public_html? How?

1 Answers

I am considering your ftp user is a default user that has root path

server_dir: "public_html/"

If your user not has the root path you must consider its path until public_html

Related