Skip to content

Add a publish button to trigger a Github Action workflow

Notifications You must be signed in to change notification settings

grrr-amsterdam/nova-publish

Repository files navigation

Nova publish

Run tests Code style

Adds a publish button to Nova to trigger a GitHub workflow which runs you static site generator

Developed with ❤️ by GRRR

Requirements

Return To Top

  • PHP 8.2, 8.3, 8.4
  • Nova 4

Installation

Return To Top

Add the repository to composer.json

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/grrr-amsterdam/nova-publish"
    }
]

Add install the package

composer require grrr-amsterdam/nova-publish

Load the tool by adding it to NovaServiceProvider.php

use Publish\Publish;

public function tools()
{
    return [new Publish()];
}

Publish configuration

php artisan vendor:publish --provider="Publish\ToolServiceProvider"

Configure GitHub credentials, set the name of the workflow file and configure an application version.

=======

Local development

Run yarn run dev to watch for changes in the resources/js directory.

Use the local checkout in a project that uses this plugin. The Composer documentation explains how to do this.

To run the tests you need a Nova License and a GitHub App with access to your repository. It will use the workflow test-workflow.yml to do integration tests.

Create /.env file with the following content:

NOVA_PUBLISH_PRIVATE_KEY="your GitHub App private key"
NOVA_PUBLISH_APPLICATION_ID="your GitHub App ID"
NOVA_PUBLISH_OWNER="your GitHub owner"
NOVA_PUBLISH_REPOSITORY="your GitHub repository"

i18n

To add a language or change an existing translation, please read the Laravel documentation about overriding package language files.

GitHub credentials

You need a GitHub App to use this tool. The application must have access to the repository where the workflow is located.

About creating GitHub Apps.

Use the application ID and private key in config/publish.php.

Contribute

You need a Nova license to run the tests.

Release new version

  • Run yarn run prod to build the assets, and commit the changes
  • Add the new version to CHANGELOG.md