Drupal 9

Change the class on the Submit Button on the Search Block Form

We can use the hook_form_alter() function.  You can place it within your theme.theme file or in your custom module.

/**
 * Implementation of hook_form_alter()
 * To: change the class on the submit button on the search_block_form from 'btn-primary' to 'btn-secondary'
 */

function {mythemename}_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'search_block_form') {
    $form['actions']['submit']['#attributes']['class'][] = 'btn-secondary';
  }
}

If you want to print out the variables you can as below or the Devel module.