Update deploy-main.yml #60
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: CI/CD - Crudzaso | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GH_PAT }} | |
- name: Set up SSH Agent | |
uses: webfactory/ssh-agent@v0.9.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_KEY_SERVER }} | |
- name: Deploy Application | |
run: | | |
ssh -o StrictHostKeyChecking=no ${{ secrets.USERNAME_SERVER }}@${{ secrets.HOST_SERVER }} << 'EOF' | |
git config --global --add safe.directory /var/www/gananza | |
cd ${{ secrets.PATH }} | |
git pull origin main | |
echo '${{ secrets.ENV_FILE }}' > .env | |
composer install --no-dev --optimize-autoloader | |
php artisan migrate --force | |
php artisan optimize:clear | |
EOF |