Posted on under Laravel by Owen Conti.
Here's a quick GitHub Actions file you can use to deploy Laravel Vapor applications.
phpcs
and
phpunit
staging
branch to the
staging
Vapor environmentmaster
branch to the
production
Vapor environmentFeel free to change any details to suite your application.
The only requirement is you will need to define a
VAPOR_API_TOKEN
secret.
1name: Build 2on: [push, workflow_dispatch] 3 4jobs: 5 build-php: 6 services: 7 mysql: 8 image: mysql:8.0 9 env:10 MYSQL_USER: root11 MYSQL_ROOT_PASSWORD: root12 MYSQL_DATABASE: laravel13 ports:14 - 3306:330615 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=316 17 name: Build PHP18 runs-on: ubuntu-latest19 container: lorisleiva/laravel-docker:7.420 steps:21 - uses: actions/checkout@v222 - run: composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts23 - run: ./vendor/bin/phpcs --standard=./phpcs.xml --extensions=php app --warning-severity=024 - run: npm ci25 - run: npm run dev26 - name: Configure application27 run: |28 cp .env.ci .env29 php artisan cache:clear30 php artisan config:clear31 php artisan key:generate32 - run: ./vendor/bin/phpunit --colors=never33 34 deploy:35 if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging'36 name: Deploy application37 runs-on: ubuntu-latest38 container: lorisleiva/laravel-docker:7.439 needs: [build-php]40 env:41 VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }}42 VAPOR_ENV: ${{ github.ref == 'refs/heads/master' && 'production' || 'staging' }}43 steps:44 - uses: actions/checkout@v245 - run: composer install --no-dev --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts46 - run: ./vendor/bin/vapor deploy ${{ env.VAPOR_ENV }}
Hopefully you found this article useful! If you did, share it on X!
Found an issue with the article? Submit your edits against the repository.