-
-
Save jamesnyakush/c7c05fdd365c4b86b10d0608c3eeece0 to your computer and use it in GitHub Desktop.
workflow sample to deploy laravel/react app to cpanel using FTP account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteRule ^(.*)$ public/$1 [L] | |
</IfModule> | |
<Files .env> | |
Order allow,deny | |
Deny from all | |
</Files> | |
<Files config> | |
Order Deny,Allow | |
Deny from all | |
</Files> | |
# php -- BEGIN cPanel-generated handler, do not edit | |
# Set the “ea-php82” package as the default “PHP” programming language. | |
<IfModule mime_module> | |
AddHandler application/x-httpd-ea-php82 .php .php8 .phtml | |
</IfModule> | |
# php -- END cPanel-generated handler, do not edit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration and Deployment | |
on: | |
push: | |
branches: "main" | |
jobs: | |
laravel-tests: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ROOT_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
MYSQL_DATABASE: ${{ secrets.DB_DATABASE }} | |
MYSQL_USER: ${{ secrets.DB_USER }} | |
MYSQL_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping --password=root_password" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e | |
with: | |
php-version: "8.2" | |
- uses: actions/checkout@v3 | |
- name: Copy .env | |
run: php -r "file_exists('.env') || copy('.env.example', '.env');" | |
- name: Install Dependencies | |
run: | | |
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Clear Config and Cache | |
run: | | |
php artisan config:clear | |
php artisan cache:clear | |
php artisan route:clear | |
- name: Set Directory Permissions | |
run: chmod -R 777 storage bootstrap/cache | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install npm Dependencies | |
run: | | |
npm install -g npm@latest | |
npm cache clean --force | |
- name: Build Frontend Assets | |
run: npm run build | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: public/ | |
- name: Deploy to Server | |
uses: SamKirkland/FTP-Deploy-Action@v4.3.5 | |
with: | |
server: ${{ secrets.FTP_SERVER }} | |
username: ${{ secrets.FTP_USERNAME }} | |
password: ${{ secrets.FTP_PASSWORD }} | |
server-dir: / |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment