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 7.4
  • GitHub Actions workflow

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 path to the workflow file and configure an application version.

GitHub API credentials

Personal Access Tokens (PATs) are currently the only way to access the GitHub API. The token is created by a GitHub user. So when this user is removed from the GitHub organization the token must be recreated by another user. Not ideal, so there is room for improvement.

Create a Personal Access Token: https://github.com/settings/tokens

  • Note: the name of the project
  • Expiration: No expiration (or you have to replace the token every time it expires)
  • Scopes: "repo" and "workflow"

Add the created token as environment variable PUBLISH_GITHUB_PERSONAL_ACCESS_TOKEN.

You GitHub username must be stored in PUBLISH_GITHUB_USERNAME.

Contribute

You need a Nova license to run the tests.