Skip to content

Instantly share code, notes, and snippets.

@ezeanyimhenry
Created September 3, 2024 07:01
Show Gist options
  • Select an option

  • Save ezeanyimhenry/c082962fdfcc78271b536cff07f6168d to your computer and use it in GitHub Desktop.

Select an option

Save ezeanyimhenry/c082962fdfcc78271b536cff07f6168d to your computer and use it in GitHub Desktop.

Revisions

  1. ezeanyimhenry created this gist Sep 3, 2024.
    19 changes: 19 additions & 0 deletions .htaccess
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    <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
    61 changes: 61 additions & 0 deletions deploy-laravel-react.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,61 @@
    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: /