add examples for publish:azure scaffolder action

Signed-off-by: Marc Buchardt <marc@buchardtprivat.de>
This commit is contained in:
Marc Buchardt
2023-10-06 13:51:02 +02:00
parent 57a7c089aa
commit 7c5d90e48d
2 changed files with 72 additions and 0 deletions
@@ -0,0 +1,70 @@
/*
* Copyright 2023 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TemplateExample } from '@backstage/plugin-scaffolder-node';
import yaml from 'yaml';
export const examples: TemplateExample[] = [
{
description:
'Initializes a git repository of the content in the workspace, and publishes it to Azure.',
example: yaml.stringify({
steps: [
{
id: 'publish',
action: 'publish:azure',
name: 'Publish to Azure',
input: {
repoUrl: 'dev.azure.com/organisation/project/_git/repo',
},
},
],
}),
},
{
description: 'Add a description.',
example: yaml.stringify({
steps: [
{
id: 'publish',
action: 'publish:azure',
name: 'Publish to Azure',
input: {
repoUrl: 'dev.azure.com/organisation/project/_git/repo',
description: 'Initialize a git repository',
},
},
],
}),
},
{
description: 'Change the default branch.',
example: yaml.stringify({
steps: [
{
id: 'publish',
action: 'publish:azure',
name: 'Publish to Azure',
input: {
repoUrl: 'dev.azure.com/organisation/project/_git/repo',
description: 'Initialize a git repository',
defaultBranch: 'main',
},
},
],
}),
},
];
@@ -29,6 +29,7 @@ import {
import { getRepoSourceDirectory, parseRepoUrl } from './util';
import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
import { Config } from '@backstage/config';
import { examples } from './azure.examples';
/**
* Creates a new action that initializes a git repository of the content in the workspace
@@ -52,6 +53,7 @@ export function createPublishAzureAction(options: {
gitAuthorEmail?: string;
}>({
id: 'publish:azure',
examples,
description:
'Initializes a git repository of the content in the workspace, and publishes it to Azure.',
schema: {