55 lines
1.3 KiB
YAML
55 lines
1.3 KiB
YAML
name: Deploy Wishlist
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Create .env file from secrets
|
|
run: |
|
|
echo "$ENV_PROD" > .env
|
|
if [ ! -s .env ]; then
|
|
echo "Error: .env file is empty!"
|
|
exit 1
|
|
fi
|
|
env:
|
|
ENV_PROD: ${{ secrets.ENV_PROD }}
|
|
|
|
- name: Install PHP dependencies
|
|
run: composer install
|
|
|
|
- name: Install Node.js dependencies
|
|
run: npm i
|
|
|
|
- name: Build assets
|
|
run: npm run build
|
|
|
|
#- name: Prepare deployment directory
|
|
# run: |
|
|
# sudo chown -R $USER:$USER $DEPLOY_DIR
|
|
# sudo chmod -R 775 $DEPLOY_DIR
|
|
|
|
- name: Copy files to deployment directory
|
|
run: |
|
|
sudo rsync -av ./ ${DEPLOY_DIR}/
|
|
|
|
#- name: Run migrations
|
|
# run: php artisan migrate --force
|
|
|
|
#- name: Clear cache
|
|
# run: |
|
|
# php artisan cache:clear
|
|
# php artisan view:clear
|
|
# php artisan route:clear
|
|
# php artisan config:clear
|
|
|
|
- name: Restart PHP service
|
|
run: sudo systemctl restart php8.2-fpm
|
|
|
|
- name: Restart Nginx
|
|
run: sudo systemctl restart nginx |