Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

GitHubActionTutorial.tsx 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2024 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. import { BasicSeparator, Title, TutorialStep, TutorialStepList } from 'design-system';
  21. import * as React from 'react';
  22. import { translate } from '../../../helpers/l10n';
  23. import { AlmKeys, AlmSettingsInstance } from '../../../types/alm-settings';
  24. import { Component } from '../../../types/types';
  25. import { LoggedInUser } from '../../../types/users';
  26. import AllSet from '../components/AllSet';
  27. import YamlFileStep from '../components/YamlFileStep';
  28. import AnalysisCommand from './AnalysisCommand';
  29. import SecretStep from './SecretStep';
  30. export interface GitHubActionTutorialProps {
  31. almBinding?: AlmSettingsInstance;
  32. baseUrl: string;
  33. component: Component;
  34. currentUser: LoggedInUser;
  35. monorepo?: boolean;
  36. mainBranchName: string;
  37. willRefreshAutomatically?: boolean;
  38. }
  39. export default function GitHubActionTutorial(props: GitHubActionTutorialProps) {
  40. const [done, setDone] = React.useState<boolean>(false);
  41. const {
  42. almBinding,
  43. baseUrl,
  44. currentUser,
  45. component,
  46. monorepo,
  47. mainBranchName,
  48. willRefreshAutomatically,
  49. } = props;
  50. const secretStepTitle = `onboarding.tutorial.with.github_action.create_secret.title${monorepo ? '.monorepo' : ''}`;
  51. return (
  52. <>
  53. <Title>{translate('onboarding.tutorial.with.github_ci.title')}</Title>
  54. <TutorialStepList className="sw-mb-8">
  55. <TutorialStep title={translate(secretStepTitle)}>
  56. <SecretStep
  57. almBinding={almBinding}
  58. baseUrl={baseUrl}
  59. component={component}
  60. currentUser={currentUser}
  61. monorepo={monorepo}
  62. />
  63. </TutorialStep>
  64. <TutorialStep title={translate('onboarding.tutorial.with.github_action.yaml.title')}>
  65. <YamlFileStep setDone={setDone}>
  66. {(buildTool) => (
  67. <AnalysisCommand
  68. buildTool={buildTool}
  69. mainBranchName={mainBranchName}
  70. component={component}
  71. monorepo={monorepo}
  72. />
  73. )}
  74. </YamlFileStep>
  75. </TutorialStep>
  76. {done && (
  77. <>
  78. <BasicSeparator className="sw-my-10" />
  79. <AllSet
  80. alm={almBinding?.alm || AlmKeys.GitHub}
  81. willRefreshAutomatically={willRefreshAutomatically}
  82. />
  83. </>
  84. )}
  85. </TutorialStepList>
  86. </>
  87. );
  88. }