vapor 🚀
laravel 🚀
nova 🚀
Nova Vapor

Just some steps I need to remember for getting this setup.

.github/workflows/ci-cd.yml needs to have the commands to install nova

name: CI-CD

on: [push]

# Thanks to https://github.com/shivammathur/setup-php/blob/master/examples/laravel-mysql.yml
jobs:
  ci:
    runs-on: ubuntu-latest
    env:
      DB_DATABASE: test
      DB_USERNAME: root
      DB_PASSWORD: password
      APP_ENV: testing
      BROADCAST_DRIVER: log
    services:
      mysql:
        image: mysql:5.7
        env:
          MYSQL_ALLOW_EMPTY_PASSWORD: false
          MYSQL_ROOT_PASSWORD: password
          MYSQL_DATABASE: test
        ports:
          - 3306/tcp
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
    strategy:
      fail-fast: false
      matrix:
        php-versions: ["8.1"]
    steps:
      - uses: actions/checkout@v2

      - name: Setup PHP, with composer and extensions
        uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
        with:
          php-version: $
          tools: phpmd
          extensions: mbstring, dom, fileinfo, mysql, grpc
          coverage: xdebug #optional

      - name: Start mysql service
        run: sudo /etc/init.d/mysql start

      - name: Get composer cache directory
        id: composer-cache
        run: echo "::set-output name=dir::$(composer config cache-files-dir)"

      - name: Cache composer dependencies
        uses: actions/cache@v2
        with:
          path: $
          # Use composer.json for key, if composer.lock is not committed.
          # key: $-composer-$
          key: $-composer-$
          restore-keys: $-composer-

      - name: Install Composer dependencies
        run: |
          composer config http-basic.nova.laravel.com $ $
          composer install --no-progress --prefer-dist --optimize-autoloader

      - name: Prepare the application
        run: |
          php -r "file_exists('.env') || copy('.env.example', '.env');"
          php artisan key:generate

      - name: Clear Config
        run: php artisan config:clear

      - name: PHP Code Style (phpcs)
        run: |
          composer fix

      - name: Migrations
        run: |
          sudo cp .env.github .env
          php artisan storage:link

      - name: Test with phpunit
        run: |
          npm install && npm run build
          XDEBUG_MODE=coverage php artisan test --coverage  --min=50
        env:
          DB_PORT: $

  cd:
    runs-on: ubuntu-latest
    needs: ci
    if: github.ref == 'refs/heads/main'
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 8.1
          tools: composer:v2
          coverage: none
      - name: Require Vapor CLI
        run: composer global require laravel/vapor-cli
      - name: Install Project Dependencies
        run: |
          composer config http-basic.nova.laravel.com $ $
          composer install --no-interaction --prefer-dist --optimize-autoloader
      - name: Deploy Environment
        run: vapor deploy staging
        env:
          VAPOR_API_TOKEN: $

Adding composer config http-basic.nova.laravel.com ${{ secrets.NOVA_email}} ${{ secrets.NOVA }} to the cd part and line 58 where I build it out for testing. And of course adding those secrets to GitHub.

Then in my vapor.yml

    build:
      - 'composer config http-basic.nova.laravel.com $ $
      - 'COMPOSER_MIRROR_PATH_REPOS=1 composer install'
      - 'php artisan event:cache'
      - 'npm ci --no-audit ci && npm run build && rm -rf node_modules'

The vapor one is the tricky one this is a WIP