Skip to content

Instantly share code, notes, and snippets.

@zahidhassanshaikot
Last active June 6, 2024 10:31
Show Gist options
  • Select an option

  • Save zahidhassanshaikot/de37854eeecbd6160dd7bf7747d86c2b to your computer and use it in GitHub Desktop.

Select an option

Save zahidhassanshaikot/de37854eeecbd6160dd7bf7747d86c2b to your computer and use it in GitHub Desktop.
name: push-to-do-server
on:
push:
branches: [ main ]
jobs:
automatic-deploy:
runs-on: ubuntu-latest
steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: '8.0'
- uses: actions/checkout@v2
- name: Push to cpanel using ssh key
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
cd /home/biyerjuti_dev/web/biyerjuti.com/public_html
git pull
php -r "file_exists('.env') || copy('.env.example', '.env');"
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
php artisan key:generate
php artisan migrate
php artisan optimize:clear
chmod 775 -R ./storage
chown -R biyerjuti_dev:www-data ./storage
name: 🚀 Deploy website on push to main
on:
push:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands
uses: appleboy/ssh-action@v0.1.10
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.PORT }}
script: |
cd ${{ secrets.TARGET_FOLDER_PATH }}
ssh-add ~/.ssh/id_rsa
git stash
git pull
composer install --optimize-autoloader --no-dev
php artisan config:cache
php artisan event:cache
php artisan route:cache
php artisan view:cache
php artisan migrate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment