echo '' > .env #7
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: Backend CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| jobs: | |
| build-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.4' | |
| extensions: mbstring, pdo_mysql | |
| - name: Install Composer dependencies | |
| run: composer install --prefer-dist --no-progress --no-interaction | |
| - name: Generate application key | |
| run: echo '' > .env && php artisan key:generate | |
| - name: Optimize Laravel | |
| run: php artisan optimize | |
| - name: Run tests | |
| run: php artisan test --without-tty | |
| - name: Build Docker image | |
| run: docker build -t ghcr.io/${{ github.repository }}:latest . | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Push image | |
| run: docker push ghcr.io/${{ github.repository }}:latest |