feat: add gabia version #2
This file contains hidden or 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: Deploy to EC2 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| concurrency: | |
| group: deploy-production | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy over SSH | |
| uses: appleboy/ssh-action@v1.2.0 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USER }} | |
| key: ${{ secrets.EC2_KEY }} | |
| port: ${{ secrets.PORT }} | |
| script_stop: true | |
| script: | | |
| set -e | |
| APP_DIR=/var/www/remit | |
| BRANCH=main | |
| cd "$APP_DIR" | |
| git fetch origin "$BRANCH" | |
| git checkout "$BRANCH" | |
| git pull origin "$BRANCH" | |
| composer install --no-dev --optimize-autoloader | |
| if [ -f package-lock.json ]; then | |
| npm ci | |
| else | |
| npm install | |
| fi | |
| npm run build | |
| php artisan migrate --force | |
| php artisan optimize:clear | |
| php artisan config:cache | |
| php artisan route:cache | |
| php artisan view:cache |