There are cases that you would like to use Laravel Nova in CircleCI. If you decided to install Nova via composer by adding a custom repository in your composer.json file, you will be asked to authenticate using your Nova credentials.

Since you don't really want to store your Nova credentials in an auth.json file and add it in your project's version control history, you must find another way for your CI to make use of your authentication credentials.

CircleCI Environment Variables

To solve this issue, you can use CircleCI Environment Variables. Visit https://circleci.com, navigate to the project that you want to add your environment variables to and add your NOVA_USERNAME and NOVA_PASSWORD variables.

Back to your project, create a directory called .circleci at the root of your project and add a config.yml file inside, with the following format:

# PHP CircleCI 2.0 configuration file
#
# Check <https://circleci.com/docs/2.0/language-php/> for more details
#
version: 2
jobs:
  build:
    docker:
      # Specify the version you desire here
      - image: circleci/php:7.3-stretch-node-browsers

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at <https://circleci.com/docs/2.0/circleci-images/>
      # Using the RAM variation mitigates I/O contention
      # for database intensive operations.
      # - image: circleci/mysql:5.7-ram
      #
      # - image: redis:3

    steps:
      - checkout

      - run: sudo apt update && sudo apt install zlib1g-dev libsqlite3-dev
      - run: sudo docker-php-ext-install zip pcntl bcmath

      # Download and cache dependencies

      # composer cache
      - restore_cache:
          keys:
            # "composer.lock" can be used if it is committed to the repo
            - v1-dependencies-{{ checksum "composer.json" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      - run: echo "{\"http-basic\":{\"nova.laravel.com\":{\"username\":\"${NOVA_USERNAME}\",\"password\":\"${NOVA_PASSWORD}\"}}}" > auth.json
      - run: composer install -n --prefer-dist

      - save_cache:
          key: composer-v1-{{ checksum "composer.lock" }}
          paths:
            - vendor

      # prepare the database
      - run: touch storage/testing.sqlite
       # setting up environment
      - run: cp .env.example .env
       # set encryption key
      - run: php artisan key:generate
      - run: php artisan migrate --env=testing --database=sqlite_testing --force
      - run: openssl genrsa -out storage/oauth-private.key 4096
      - run: openssl rsa -in storage/oauth-private.key -pubout > storage/oauth-public.key

      - run: ./vendor/bin/phpunit --debug

From now on, you should be now able to authenticate Laravel Nova in CircleCI.

Enjoy!