How can I register blueprint/group-field in plugin?

Hi, how can I register a blueprint/group-field inside a plugin?

I´ve tried…

// path: plugins/my-plugin/my-plugin.php
$kirby->set('blueprint/field', 'testgroup2', __DIR__. DS .'testgroup2.yml');
# path: plugins/my-plugin/testgroup2.yml
type: group
fields:
  testgroup2_headline:
   label: Testgroup 2
   type: headline
  testgroup2_text:
    label: Text 
    type:  text

Assuming that the file is called metadata.yml and lives in /site/plugins/your-plugin/blueprints/fields:

<?php

kirby()->set('blueprint', 'fields/metadata', __DIR__ . '/blueprints/fields/metadata.yml');

Works perfectly!

Thank you very much texnixe!