Replace references to GHE with GitHub
Signed-off-by: Erik Engervall <erik.engervall@gmail.com>
This commit is contained in:
@@ -4,19 +4,19 @@
|
||||
|
||||
`RMaaS` enables developers to manage their releases without having to juggle git commands.
|
||||
|
||||
Does it bundle and ship your code? **No**.
|
||||
Does it build and ship your code? **No**.
|
||||
|
||||
What `RMaaS` does is manage your **[releases](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/managing-releases-in-a-repository)** on GitHub, building and shipping is entirely up to you as a developer to handle in your CI.
|
||||
|
||||
`RMaaS` is build with industry standards in mind and the flow is as follows:
|
||||
`RMaaS` is built with industry standards in mind and the flow is as follows:
|
||||
|
||||

|
||||

|
||||
|
||||
> **GitHub Enterprise (GHE)**: The source control system where releases reside in a practical sense. Read more about GitHub releases here. Note that this plugin works just as well with a non-enterprise account.
|
||||
> **GitHub**: The source control system where releases reside in a practical sense. Read more about GitHub releases [here](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/. Note that this plugin works just as well with GitHub Enterprise)
|
||||
>
|
||||
> **Release Candidate (RC)**: A GHE pre-release intended primarily for internal testing
|
||||
> **Release Candidate (RC)**: A GitHub pre-release intended primarily for internal testing
|
||||
>
|
||||
> **Release Version**: A GHE release intended for end users
|
||||
> **Release Version**: A GitHub release intended for end users
|
||||
|
||||
Looking at the flow above, a common release lifecycle could be:
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ export function ReleaseManagerAsAService({
|
||||
return (
|
||||
<ApiClientContext.Provider value={RMaaSApi}>
|
||||
<div className={classes.root}>
|
||||
<ContentHeader title="Release Manager as a Service (RMaaS™️)" />
|
||||
<ContentHeader title="Release Manager as a Service (RMaaS)" />
|
||||
|
||||
<Cards project={project} components={components} />
|
||||
</div>
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
GhUpdateReleaseResponse,
|
||||
} from '../types/types';
|
||||
import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts';
|
||||
import { getRcGheInfo } from '../cards/createRc/getRcGheInfo';
|
||||
import { getRcGitHubInfo } from '../cards/createRc/getRcGitHubInfo';
|
||||
import { PluginApiClientConfig } from './PluginApiClientConfig';
|
||||
import { SemverTagParts } from '../helpers/tagParts/getSemverTagParts';
|
||||
|
||||
@@ -165,10 +165,10 @@ export class RMaaSApiClient {
|
||||
},
|
||||
|
||||
createRelease: async ({
|
||||
nextGheInfo,
|
||||
nextGitHubInfo,
|
||||
releaseBody,
|
||||
}: {
|
||||
nextGheInfo: ReturnType<typeof getRcGheInfo>;
|
||||
nextGitHubInfo: ReturnType<typeof getRcGitHubInfo>;
|
||||
releaseBody: string;
|
||||
}) => {
|
||||
const { octokit } = await this.pluginApiClient.getOctokit();
|
||||
@@ -177,9 +177,9 @@ export class RMaaSApiClient {
|
||||
await octokit.request(`${this.githubCommonPath}/releases`, {
|
||||
method: 'POST',
|
||||
data: {
|
||||
tag_name: nextGheInfo.rcReleaseTag,
|
||||
name: nextGheInfo.releaseName,
|
||||
target_commitish: nextGheInfo.rcBranch,
|
||||
tag_name: nextGitHubInfo.rcReleaseTag,
|
||||
name: nextGitHubInfo.releaseName,
|
||||
target_commitish: nextGitHubInfo.rcBranch,
|
||||
body: releaseBody,
|
||||
prerelease: true,
|
||||
},
|
||||
|
||||
@@ -18,7 +18,7 @@ import { render } from '@testing-library/react';
|
||||
|
||||
import {
|
||||
mockCalverProject,
|
||||
mockNextGheInfo,
|
||||
mockNextGitHubInfo,
|
||||
mockRcRelease,
|
||||
mockReleaseBranch,
|
||||
mockReleaseVersion,
|
||||
@@ -30,8 +30,8 @@ import { TEST_IDS } from '../../test-helpers/test-ids';
|
||||
jest.mock('../../components/ProjectContext', () => ({
|
||||
useApiClientContext: () => mockApiClient,
|
||||
}));
|
||||
jest.mock('./getRcGheInfo', () => ({
|
||||
getRcGheInfo: () => mockNextGheInfo,
|
||||
jest.mock('./getRcGitHubInfo', () => ({
|
||||
getRcGitHubInfo: () => mockNextGitHubInfo,
|
||||
}));
|
||||
|
||||
import { CreateRc } from './CreateRc';
|
||||
|
||||
@@ -25,9 +25,9 @@ import {
|
||||
} from '@material-ui/core';
|
||||
import { useAsyncFn } from 'react-use';
|
||||
|
||||
import { createGheRc } from './sideEffects/createGheRc';
|
||||
import { createRc } from './sideEffects/createRc';
|
||||
import { Differ } from '../../components/Differ';
|
||||
import { getRcGheInfo } from './getRcGheInfo';
|
||||
import { getRcGitHubInfo } from './getRcGitHubInfo';
|
||||
import { InfoCardPlus } from '../../components/InfoCardPlus';
|
||||
import {
|
||||
ComponentConfigCreateRc,
|
||||
@@ -66,37 +66,37 @@ export const CreateRc = ({
|
||||
const [semverBumpLevel, setSemverBumpLevel] = useState<'major' | 'minor'>(
|
||||
SEMVER_PARTS.minor,
|
||||
);
|
||||
const [nextGheInfo, setNextGheInfo] = useState(
|
||||
getRcGheInfo({ latestRelease, project, semverBumpLevel }),
|
||||
const [nextGitHubInfo, setNextGitHubInfo] = useState(
|
||||
getRcGitHubInfo({ latestRelease, project, semverBumpLevel }),
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
setNextGheInfo(getRcGheInfo({ latestRelease, project, semverBumpLevel }));
|
||||
}, [semverBumpLevel, setNextGheInfo, latestRelease, project]);
|
||||
setNextGitHubInfo(
|
||||
getRcGitHubInfo({ latestRelease, project, semverBumpLevel }),
|
||||
);
|
||||
}, [semverBumpLevel, setNextGitHubInfo, latestRelease, project]);
|
||||
|
||||
const [createReleaseResponse, callCreateGheRc] = useAsyncFn(
|
||||
async (...args) => {
|
||||
const createGheRcResponseSteps = await createGheRc({
|
||||
const [createGitHubReleaseResponse, createGitHubReleaseFn] = useAsyncFn(
|
||||
(...args) =>
|
||||
createRc({
|
||||
apiClient,
|
||||
defaultBranch,
|
||||
latestRelease,
|
||||
nextGheInfo: args[0],
|
||||
nextGitHubInfo: args[0],
|
||||
successCb,
|
||||
});
|
||||
|
||||
return createGheRcResponseSteps;
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
if (createReleaseResponse.error) {
|
||||
if (createGitHubReleaseResponse.error) {
|
||||
return (
|
||||
<Alert severity="error">{createReleaseResponse.error.message}</Alert>
|
||||
<Alert severity="error">
|
||||
{createGitHubReleaseResponse.error.message}
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
|
||||
const tagAlreadyExists =
|
||||
latestRelease !== null &&
|
||||
latestRelease.tag_name === nextGheInfo.rcReleaseTag;
|
||||
latestRelease.tag_name === nextGitHubInfo.rcReleaseTag;
|
||||
const conflictingPreRelease =
|
||||
latestRelease !== null && latestRelease.prerelease;
|
||||
|
||||
@@ -113,7 +113,7 @@ export const CreateRc = ({
|
||||
return (
|
||||
<Alert className={classes.paragraph} severity="warning">
|
||||
There's already a tag named{' '}
|
||||
<strong>{nextGheInfo.rcReleaseTag}</strong>
|
||||
<strong>{nextGitHubInfo.rcReleaseTag}</strong>
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
@@ -124,7 +124,7 @@ export const CreateRc = ({
|
||||
<Differ
|
||||
icon="branch"
|
||||
prev={releaseBranch?.name}
|
||||
next={nextGheInfo.rcBranch}
|
||||
next={nextGitHubInfo.rcBranch}
|
||||
/>
|
||||
</Typography>
|
||||
|
||||
@@ -132,7 +132,7 @@ export const CreateRc = ({
|
||||
<Differ
|
||||
icon="tag"
|
||||
prev={latestRelease?.tag_name}
|
||||
next={nextGheInfo.rcReleaseTag}
|
||||
next={nextGitHubInfo.rcReleaseTag}
|
||||
/>
|
||||
</Typography>
|
||||
</div>
|
||||
@@ -140,11 +140,14 @@ export const CreateRc = ({
|
||||
}
|
||||
|
||||
function CTA() {
|
||||
if (createReleaseResponse.loading || createReleaseResponse.value) {
|
||||
if (
|
||||
createGitHubReleaseResponse.loading ||
|
||||
createGitHubReleaseResponse.value
|
||||
) {
|
||||
return (
|
||||
<ResponseStepList
|
||||
responseSteps={createReleaseResponse.value}
|
||||
loading={createReleaseResponse.loading}
|
||||
responseSteps={createGitHubReleaseResponse.value}
|
||||
loading={createGitHubReleaseResponse.loading}
|
||||
title="Create RC result"
|
||||
setRefetch={setRefetch}
|
||||
/>
|
||||
@@ -157,7 +160,7 @@ export const CreateRc = ({
|
||||
disabled={conflictingPreRelease || tagAlreadyExists}
|
||||
variant="contained"
|
||||
color="primary"
|
||||
onClick={() => callCreateGheRc(nextGheInfo)}
|
||||
onClick={() => createGitHubReleaseFn(nextGitHubInfo)}
|
||||
>
|
||||
Create RC
|
||||
</Button>
|
||||
|
||||
+8
-8
@@ -20,19 +20,19 @@ import {
|
||||
mockSemverProject,
|
||||
mockCalverProject,
|
||||
} from '../../test-helpers/test-helpers';
|
||||
import { getRcGheInfo } from './getRcGheInfo';
|
||||
import { getRcGitHubInfo } from './getRcGitHubInfo';
|
||||
|
||||
const injectedDate = format(1611869955783, 'yyyy.MM.dd');
|
||||
|
||||
describe('getRCGheInfo', () => {
|
||||
describe('getRcGitHubInfo', () => {
|
||||
describe('calver', () => {
|
||||
const latestRelease = {
|
||||
tag_name: 'rc-2020.01.01_0',
|
||||
} as GhGetReleaseResponse;
|
||||
|
||||
it('should return correct Ghe info', () => {
|
||||
it('should return correct GitHub info', () => {
|
||||
expect(
|
||||
getRcGheInfo({
|
||||
getRcGitHubInfo({
|
||||
project: mockCalverProject,
|
||||
latestRelease,
|
||||
semverBumpLevel: 'minor',
|
||||
@@ -53,9 +53,9 @@ describe('getRCGheInfo', () => {
|
||||
tag_name: 'rc-1.1.1',
|
||||
} as GhGetReleaseResponse;
|
||||
|
||||
it("should return correct Ghe info when there's previous releases", () => {
|
||||
it("should return correct GitHub info when there's previous releases", () => {
|
||||
expect(
|
||||
getRcGheInfo({
|
||||
getRcGitHubInfo({
|
||||
project: mockSemverProject,
|
||||
latestRelease,
|
||||
semverBumpLevel: 'minor',
|
||||
@@ -69,9 +69,9 @@ describe('getRCGheInfo', () => {
|
||||
`);
|
||||
});
|
||||
|
||||
it("should return correct Ghe info when there's no previous release", () => {
|
||||
it("should return correct GitHub info when there's no previous release", () => {
|
||||
expect(
|
||||
getRcGheInfo({
|
||||
getRcGitHubInfo({
|
||||
project: mockSemverProject,
|
||||
latestRelease: null,
|
||||
semverBumpLevel: 'minor',
|
||||
+1
-1
@@ -20,7 +20,7 @@ import { getSemverTagParts } from '../../helpers/tagParts/getSemverTagParts';
|
||||
import { Project, GhGetReleaseResponse } from '../../types/types';
|
||||
import { SEMVER_PARTS } from '../../constants/constants';
|
||||
|
||||
export const getRcGheInfo = ({
|
||||
export const getRcGitHubInfo = ({
|
||||
project,
|
||||
latestRelease,
|
||||
semverBumpLevel,
|
||||
+6
-6
@@ -14,22 +14,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {
|
||||
mockDefaultBranch,
|
||||
mockReleaseVersion,
|
||||
mockNextGheInfo,
|
||||
mockApiClient,
|
||||
mockDefaultBranch,
|
||||
mockNextGitHubInfo,
|
||||
mockReleaseVersion,
|
||||
} from '../../../test-helpers/test-helpers';
|
||||
import { createGheRc } from './createGheRc';
|
||||
import { createRc } from './createRc';
|
||||
|
||||
describe('createGheRc', () => {
|
||||
beforeEach(jest.clearAllMocks);
|
||||
|
||||
it('should work', async () => {
|
||||
const result = await createGheRc({
|
||||
const result = await createRc({
|
||||
apiClient: mockApiClient,
|
||||
defaultBranch: mockDefaultBranch,
|
||||
latestRelease: mockReleaseVersion,
|
||||
nextGheInfo: mockNextGheInfo,
|
||||
nextGitHubInfo: mockNextGitHubInfo,
|
||||
});
|
||||
|
||||
expect(result).toMatchInlineSnapshot(`
|
||||
+12
-12
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { getRcGheInfo } from '../getRcGheInfo';
|
||||
import { getRcGitHubInfo } from '../getRcGitHubInfo';
|
||||
import {
|
||||
ComponentConfigCreateRc,
|
||||
GhCreateReferenceResponse,
|
||||
@@ -24,21 +24,21 @@ import {
|
||||
import { RMaaSApiClient } from '../../../api/RMaaSApiClient';
|
||||
import { ReleaseManagerAsAServiceError } from '../../../errors/ReleaseManagerAsAServiceError';
|
||||
|
||||
interface CreateGheRC {
|
||||
interface CreateRC {
|
||||
apiClient: RMaaSApiClient;
|
||||
defaultBranch: GhGetRepositoryResponse['default_branch'];
|
||||
latestRelease: GhGetReleaseResponse | null;
|
||||
nextGheInfo: ReturnType<typeof getRcGheInfo>;
|
||||
nextGitHubInfo: ReturnType<typeof getRcGitHubInfo>;
|
||||
successCb?: ComponentConfigCreateRc['successCb'];
|
||||
}
|
||||
|
||||
export async function createGheRc({
|
||||
export async function createRc({
|
||||
apiClient,
|
||||
defaultBranch,
|
||||
latestRelease,
|
||||
nextGheInfo,
|
||||
nextGitHubInfo,
|
||||
successCb,
|
||||
}: CreateGheRC) {
|
||||
}: CreateRC) {
|
||||
const responseSteps: ResponseStep[] = [];
|
||||
|
||||
/**
|
||||
@@ -62,13 +62,13 @@ export async function createGheRc({
|
||||
createdRef = (
|
||||
await apiClient.createRc.createRef({
|
||||
mostRecentSha,
|
||||
targetBranch: nextGheInfo.rcBranch,
|
||||
targetBranch: nextGitHubInfo.rcBranch,
|
||||
})
|
||||
).createdRef;
|
||||
} catch (error) {
|
||||
if (error.body.message === 'Reference already exists') {
|
||||
throw new ReleaseManagerAsAServiceError(
|
||||
`Branch "${nextGheInfo.rcBranch}" already exists: .../tree/${nextGheInfo.rcBranch}`,
|
||||
`Branch "${nextGitHubInfo.rcBranch}" already exists: .../tree/${nextGitHubInfo.rcBranch}`,
|
||||
);
|
||||
}
|
||||
throw error;
|
||||
@@ -84,7 +84,7 @@ export async function createGheRc({
|
||||
const previousReleaseBranch = latestRelease
|
||||
? latestRelease.target_commitish
|
||||
: defaultBranch;
|
||||
const nextReleaseBranch = nextGheInfo.rcBranch;
|
||||
const nextReleaseBranch = nextGitHubInfo.rcBranch;
|
||||
const { comparison } = await apiClient.createRc.getComparison({
|
||||
previousReleaseBranch,
|
||||
nextReleaseBranch,
|
||||
@@ -105,15 +105,15 @@ export async function createGheRc({
|
||||
});
|
||||
|
||||
/**
|
||||
* 4. Creates the release itself in GHE
|
||||
* 4. Creates the release itself in GitHub
|
||||
*/
|
||||
const { createReleaseResponse } = await apiClient.createRc.createRelease({
|
||||
nextGheInfo,
|
||||
nextGitHubInfo: nextGitHubInfo,
|
||||
releaseBody,
|
||||
});
|
||||
responseSteps.push({
|
||||
message: `Created Release Candidate "${createReleaseResponse.name}"`,
|
||||
secondaryMessage: `with tag "${nextGheInfo.rcReleaseTag}"`,
|
||||
secondaryMessage: `with tag "${nextGitHubInfo.rcReleaseTag}"`,
|
||||
link: createReleaseResponse.html_url,
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
} from '../../types/types';
|
||||
import { useStyles } from '../../styles/styles';
|
||||
import { TEST_IDS } from '../../test-helpers/test-ids';
|
||||
import rmaasFlowImage from './rmaas-flow.png';
|
||||
import flowImage from './flow.png';
|
||||
|
||||
interface InfoCardProps {
|
||||
releaseBranch: GhGetBranchResponse | null;
|
||||
@@ -46,26 +46,26 @@ export const Info = ({
|
||||
<Typography variant="h6">Terminology</Typography>
|
||||
|
||||
<Typography>
|
||||
<strong>GitHub Enterprise (GHE)</strong>: The source control system
|
||||
where releases reside in a practical sense. Read more about GitHub
|
||||
releases{' '}
|
||||
<strong>GitHub</strong>: The source control system where releases
|
||||
reside in a practical sense. Read more about GitHub releases{' '}
|
||||
<Link
|
||||
href="https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/managing-releases-in-a-repository"
|
||||
target="_blank"
|
||||
>
|
||||
here
|
||||
</Link>
|
||||
. Note that this plugin works just as well with a non-enterprise
|
||||
account.
|
||||
. Note that this plugin works just as well with GitHub Enterprise
|
||||
(GHE)
|
||||
</Typography>
|
||||
|
||||
<Typography>
|
||||
<strong>Release Candidate</strong>: A GHE <i>pre-release</i> intended
|
||||
primarily for internal testing
|
||||
<strong>Release Candidate</strong>: A GitHub <i>prerelease</i>{' '}
|
||||
intended primarily for internal testing
|
||||
</Typography>
|
||||
|
||||
<Typography>
|
||||
<strong>Release Version</strong>: A GHE release intended for end users
|
||||
<strong>Release Version</strong>: A GitHub release intended for end
|
||||
users
|
||||
</Typography>
|
||||
</div>
|
||||
|
||||
@@ -82,7 +82,7 @@ export const Info = ({
|
||||
Here's an overview of the flow:
|
||||
</Typography>
|
||||
|
||||
<img alt="rmaas-flow" src={rmaasFlowImage} style={{ width: '100%' }} />
|
||||
<img alt="flow" src={flowImage} style={{ width: '100%' }} />
|
||||
</div>
|
||||
|
||||
<div style={{ marginBottom: '1em' }}>
|
||||
@@ -91,7 +91,7 @@ export const Info = ({
|
||||
<Typography>
|
||||
Repository:{' '}
|
||||
<Differ
|
||||
icon="ghe"
|
||||
icon="github"
|
||||
next={`${project.github.org}/${project.github.repo}`}
|
||||
/>
|
||||
</Typography>
|
||||
|
||||
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
@@ -69,7 +69,7 @@ export const PatchBody = ({
|
||||
const apiClient = useApiClientContext();
|
||||
const [checkedCommitIndex, setCheckedCommitIndex] = useState(-1);
|
||||
|
||||
const gheDataResponse = useAsync(async () => {
|
||||
const githubDataResponse = useAsync(async () => {
|
||||
const [
|
||||
{ branch: releaseBranchResponse },
|
||||
{ recentCommits },
|
||||
@@ -91,7 +91,7 @@ export const PatchBody = ({
|
||||
};
|
||||
});
|
||||
|
||||
const [patchGheRcResponse, patchGheRcFn] = useAsyncFn(async (...args) => {
|
||||
const [patchReleaseResponse, patchReleaseFn] = useAsyncFn(async (...args) => {
|
||||
const selectedPatchCommit: GhGetCommitResponse = args[0];
|
||||
const patchResponseSteps = await patch({
|
||||
apiClient,
|
||||
@@ -105,17 +105,17 @@ export const PatchBody = ({
|
||||
return patchResponseSteps;
|
||||
});
|
||||
|
||||
if (gheDataResponse.error) {
|
||||
if (githubDataResponse.error) {
|
||||
return (
|
||||
<Alert data-testid={TEST_IDS.patch.error} severity="error">
|
||||
{gheDataResponse.error.message}
|
||||
{githubDataResponse.error.message}
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
if (patchGheRcResponse.error) {
|
||||
return <Alert severity="error">{patchGheRcResponse.error.message}</Alert>;
|
||||
if (patchReleaseResponse.error) {
|
||||
return <Alert severity="error">{patchReleaseResponse.error.message}</Alert>;
|
||||
}
|
||||
if (gheDataResponse.loading) {
|
||||
if (githubDataResponse.loading) {
|
||||
return <CircularProgress data-testid={TEST_IDS.patch.loading} />;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ export const PatchBody = ({
|
||||
severity="info"
|
||||
>
|
||||
<AlertTitle>
|
||||
The current GHE release is a <b>Release Version</b>
|
||||
The current GitHub release is a <b>Release Version</b>
|
||||
</AlertTitle>
|
||||
It's still possible to patch it, but be extra mindful of changes
|
||||
</Alert>
|
||||
@@ -145,14 +145,14 @@ export const PatchBody = ({
|
||||
}
|
||||
|
||||
function CommitList() {
|
||||
if (!gheDataResponse.value?.recentCommits) {
|
||||
if (!githubDataResponse.value?.recentCommits) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<List>
|
||||
{gheDataResponse.value.recentCommits.map((commit, index) => {
|
||||
const commitExistsOnReleaseBranch = !!gheDataResponse.value?.recentReleaseBranchCommits.find(
|
||||
{githubDataResponse.value.recentCommits.map((commit, index) => {
|
||||
const commitExistsOnReleaseBranch = !!githubDataResponse.value?.recentReleaseBranchCommits.find(
|
||||
({ sha }) => {
|
||||
return sha === commit.sha;
|
||||
},
|
||||
@@ -185,9 +185,9 @@ export const PatchBody = ({
|
||||
|
||||
<ListItem
|
||||
disabled={
|
||||
patchGheRcResponse.loading ||
|
||||
(patchGheRcResponse.value &&
|
||||
patchGheRcResponse.value.length > 0) ||
|
||||
patchReleaseResponse.loading ||
|
||||
(patchReleaseResponse.value &&
|
||||
patchReleaseResponse.value.length > 0) ||
|
||||
commitExistsOnReleaseBranch
|
||||
}
|
||||
role={undefined}
|
||||
@@ -252,11 +252,11 @@ export const PatchBody = ({
|
||||
}
|
||||
|
||||
function CTA() {
|
||||
if (patchGheRcResponse.loading || patchGheRcResponse.value) {
|
||||
if (patchReleaseResponse.loading || patchReleaseResponse.value) {
|
||||
return (
|
||||
<ResponseStepList
|
||||
responseSteps={patchGheRcResponse.value}
|
||||
loading={patchGheRcResponse.loading}
|
||||
responseSteps={patchReleaseResponse.value}
|
||||
loading={patchReleaseResponse.loading}
|
||||
title="Patch result"
|
||||
setRefetch={setRefetch}
|
||||
closeable
|
||||
@@ -264,7 +264,7 @@ export const PatchBody = ({
|
||||
);
|
||||
}
|
||||
|
||||
if (!gheDataResponse.value?.recentCommits[checkedCommitIndex]) {
|
||||
if (!githubDataResponse.value?.recentCommits[checkedCommitIndex]) {
|
||||
return (
|
||||
<Button disabled variant="contained" color="primary">
|
||||
Patch Release Candidate
|
||||
@@ -279,8 +279,8 @@ export const PatchBody = ({
|
||||
color="primary"
|
||||
onClick={() => {
|
||||
// FIXME: Optional chaining shouldn't be needed here due to the if-statement above
|
||||
patchGheRcFn(
|
||||
gheDataResponse.value?.recentCommits[checkedCommitIndex],
|
||||
patchReleaseFn(
|
||||
githubDataResponse.value?.recentCommits[checkedCommitIndex],
|
||||
);
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -53,7 +53,9 @@ export const PromoteRc = ({
|
||||
className={classes.paragraph}
|
||||
severity="warning"
|
||||
>
|
||||
<AlertTitle>Latest GHE release is not a Release Candidate</AlertTitle>
|
||||
<AlertTitle>
|
||||
Latest GitHub release is not a Release Candidate
|
||||
</AlertTitle>
|
||||
One can only promote Release Candidates to Release Versions
|
||||
</Alert>
|
||||
);
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
GhGetReleaseResponse,
|
||||
SetRefetch,
|
||||
} from '../../types/types';
|
||||
import { promoteGheRc } from './sideEffects/promoteGheRc';
|
||||
import { promoteRc } from './sideEffects/promoteRc';
|
||||
import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList';
|
||||
import { useApiClientContext } from '../../components/ProjectContext';
|
||||
import { useStyles } from '../../styles/styles';
|
||||
@@ -44,12 +44,14 @@ export const PromoteRcBody = ({
|
||||
const apiClient = useApiClientContext();
|
||||
const classes = useStyles();
|
||||
const releaseVersion = rcRelease.tag_name.replace('rc-', 'version-');
|
||||
const [promoteGheRcResponse, promoseGheRcFn] = useAsyncFn(
|
||||
promoteGheRc({ apiClient, rcRelease, releaseVersion, successCb }),
|
||||
const [promoteGitHubRcResponse, promoseGitHubRcFn] = useAsyncFn(
|
||||
promoteRc({ apiClient, rcRelease, releaseVersion, successCb }),
|
||||
);
|
||||
|
||||
if (promoteGheRcResponse.error) {
|
||||
return <Alert severity="error">{promoteGheRcResponse.error.message}</Alert>;
|
||||
if (promoteGitHubRcResponse.error) {
|
||||
return (
|
||||
<Alert severity="error">{promoteGitHubRcResponse.error.message}</Alert>
|
||||
);
|
||||
}
|
||||
|
||||
function Description() {
|
||||
@@ -67,13 +69,13 @@ export const PromoteRcBody = ({
|
||||
}
|
||||
|
||||
function CTA() {
|
||||
if (promoteGheRcResponse.loading || promoteGheRcResponse.value) {
|
||||
if (promoteGitHubRcResponse.loading || promoteGitHubRcResponse.value) {
|
||||
return (
|
||||
<ResponseStepList
|
||||
responseSteps={promoteGheRcResponse.value}
|
||||
responseSteps={promoteGitHubRcResponse.value}
|
||||
title="Promote RC result"
|
||||
setRefetch={setRefetch}
|
||||
loading={promoteGheRcResponse.loading}
|
||||
loading={promoteGitHubRcResponse.loading}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -83,7 +85,7 @@ export const PromoteRcBody = ({
|
||||
data-testid={TEST_IDS.promoteRc.cta}
|
||||
variant="contained"
|
||||
color="primary"
|
||||
onClick={() => promoseGheRcFn()}
|
||||
onClick={() => promoseGitHubRcFn()}
|
||||
>
|
||||
Promote Release Candidate
|
||||
</Button>
|
||||
|
||||
+3
-3
@@ -17,13 +17,13 @@ import {
|
||||
mockRcRelease,
|
||||
mockApiClient,
|
||||
} from '../../../test-helpers/test-helpers';
|
||||
import { promoteGheRc } from './promoteGheRc';
|
||||
import { promoteRc } from './promoteRc';
|
||||
|
||||
describe('promoteGheRc', () => {
|
||||
describe('promoteRc', () => {
|
||||
beforeEach(jest.clearAllMocks);
|
||||
|
||||
it('should work', async () => {
|
||||
const result = await promoteGheRc({
|
||||
const result = await promoteRc({
|
||||
apiClient: mockApiClient,
|
||||
rcRelease: mockRcRelease,
|
||||
releaseVersion: 'version-1.2.3',
|
||||
+3
-3
@@ -20,19 +20,19 @@ import {
|
||||
} from '../../../types/types';
|
||||
import { RMaaSApiClient } from '../../../api/RMaaSApiClient';
|
||||
|
||||
interface PromoteGheRc {
|
||||
interface PromoteRc {
|
||||
apiClient: RMaaSApiClient;
|
||||
rcRelease: GhGetReleaseResponse;
|
||||
releaseVersion: string;
|
||||
successCb?: ComponentConfigPromoteRc['successCb'];
|
||||
}
|
||||
|
||||
export function promoteGheRc({
|
||||
export function promoteRc({
|
||||
apiClient,
|
||||
rcRelease,
|
||||
releaseVersion,
|
||||
successCb,
|
||||
}: PromoteGheRc) {
|
||||
}: PromoteRc) {
|
||||
return async (): Promise<ResponseStep[]> => {
|
||||
const responseSteps: ResponseStep[] = [];
|
||||
|
||||
@@ -25,7 +25,7 @@ interface DifferProps {
|
||||
next?: string | ReactNode;
|
||||
prev?: string;
|
||||
prefix?: string;
|
||||
icon?: 'tag' | 'branch' | 'ghe' | 'slack' | 'versioning';
|
||||
icon?: 'tag' | 'branch' | 'github' | 'slack' | 'versioning';
|
||||
}
|
||||
|
||||
const Icon = ({ icon }: { icon: DifferProps['icon'] }) => {
|
||||
@@ -40,7 +40,7 @@ const Icon = ({ icon }: { icon: DifferProps['icon'] }) => {
|
||||
<CallSplitIcon style={{ verticalAlign: 'middle' }} fontSize="small" />
|
||||
);
|
||||
|
||||
case 'ghe':
|
||||
case 'github':
|
||||
return (
|
||||
<GitHubIcon style={{ verticalAlign: 'middle' }} fontSize="small" />
|
||||
);
|
||||
|
||||
@@ -28,7 +28,7 @@ export const NoLatestRelease = () => {
|
||||
className={classes.paragraph}
|
||||
severity="warning"
|
||||
>
|
||||
Unable to find any GHE releases
|
||||
Unable to find any GitHub release
|
||||
</Alert>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ describe('testHelpers', () => {
|
||||
"versioningStrategy": "calver",
|
||||
},
|
||||
"mockDefaultBranch": "mock_defaultBranch",
|
||||
"mockNextGheInfo": Object {
|
||||
"mockNextGitHubInfo": Object {
|
||||
"rcBranch": "rc/1.2.3",
|
||||
"rcReleaseTag": "rc-1.2.3",
|
||||
"releaseName": "Version 1.2.3",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts';
|
||||
import { getRcGheInfo } from '../cards/createRc/getRcGheInfo';
|
||||
import { getRcGitHubInfo } from '../cards/createRc/getRcGitHubInfo';
|
||||
import {
|
||||
GhCompareCommitsResponse,
|
||||
GhCreateCommitResponse,
|
||||
@@ -50,7 +50,7 @@ export const mockCalverProject: Project = {
|
||||
|
||||
export const mockDefaultBranch = 'mock_defaultBranch';
|
||||
|
||||
export const mockNextGheInfo: ReturnType<typeof getRcGheInfo> = {
|
||||
export const mockNextGitHubInfo: ReturnType<typeof getRcGitHubInfo> = {
|
||||
rcBranch: 'rc/1.2.3',
|
||||
rcReleaseTag: 'rc-1.2.3',
|
||||
releaseName: 'Version 1.2.3',
|
||||
|
||||
Reference in New Issue
Block a user