Authenticating Laravel Nova in GitLab CI/CD

Published on

If you are building your application with GitLab CI/CD and you're using Laravel Nova, then you'll have to make sure the runner is authorized to download Nova.

If you use an auth.json file, make sure you don't commit this to your repository. The secrets inside this file do not belong in version control.

Instead, in your GitLab repository, go to "repository settings" and then "repository variables" and add the following two values:

  • NOVA_USERNAME
  • NOVA_LICENSE_KEY

You can then use them in your pipeline like this:

install_dependencies:
  variables: {
    nova_username: "$NOVA_USERNAME",
    nova_license_key: "$NOVA_LICENSE_KEY",
  }
  script:
    - composer config "http-basic.nova.laravel.com" "$nova_username" "$nova_license_key"
    - composer install --no-interaction --optimize-autoloader --no-dev

Your workflow can now install Nova without storing your secrets in version control.

Deploy Laravel with GitHub Actions

Check out my Laravel deployment script for GitHub Actions

Check it out