Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function selectPreviousTag(tags, { currentTag, currentMatch, containsAppP
return tags
.filter((candidate) => candidate !== `v${currentTag}`)
.map((candidate) => ({ candidate, match: parseReleaseTag(candidate) }))
.filter(({ match }) => match && compareRelease(match, currentMatch) < 0)
.filter(({ match }) => match && compareRelease(match, currentMatch) < 0 && (currentMatch[4] !== undefined || match[4] === undefined))
.filter(({ candidate }) => containsAppPackage(candidate))
.sort((left, right) => compareRelease(right.match, left.match))[0]?.candidate;
}
Expand Down Expand Up @@ -120,6 +120,15 @@ export function classifyRelease({
return 'live-update';
}

/** Requires a store build number greater than every prior native handoff in its release train. */
export function assertUnusedStoreBuild(buildNumber, handoffs) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 新規公開関数の必須JSDoc欠落

追加された公開関数 assertUnusedStoreBuild にJSDocがありません。変更時の必須規約が求める、すべての公開関数へのJSDoc付与に違反しています。

Suggested change
export function assertUnusedStoreBuild(buildNumber, handoffs) {
/** ストア配信のビルド番号が、過去のすべての引き渡し済みビルド番号を上回ることを検証する。 */
export function assertUnusedStoreBuild(buildNumber, handoffs) {

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

for (const { tag, buildNumber: previousBuild } of handoffs) {
if (Number(buildNumber) <= Number(previousBuild)) {
throw new Error(`Store build ${buildNumber} must exceed ${previousBuild} already handed off by ${tag}.`);
}
}
}

export function buildOutputLines(releaseKind, version, buildNumber) {
return [
`release_kind=${releaseKind}`,
Expand Down Expand Up @@ -196,6 +205,25 @@ export function main({ argv = process.argv.slice(2), env = process.env } = {}) {
nativeFilesChanged,
nativeDependencyChanges,
});
if (releaseKind === 'store' && tagMatch[4] === undefined) {
const [, major, minor] = tagMatch;
// The release baseline ignores prereleases, but a handoff in this train
// can still have consumed a build number.
const handoffTags = execFileSync('git', ['tag', '--list', `capawesome/v${major}.${minor}.*-*`], {
encoding: 'utf8',
}).trim();
const handoffs = handoffTags ? handoffTags.split('\n') : [];
assertUnusedStoreBuild(
native.buildNumber,
handoffs.map((tag) => ({
tag,
buildNumber: readNativeVersions(
gitShow(`${appPath}/android/app/build.gradle`, tag),
gitShow(`${appPath}/ios/App/App.xcodeproj/project.pbxproj`, tag),
).buildNumber,
})),
);
}
const lines = buildOutputLines(releaseKind, version, native.buildNumber);
if (env.GITHUB_OUTPUT) appendFileSync(env.GITHUB_OUTPUT, `${lines.join('\n')}\n`);
console.log(`Classified v${version} as ${releaseKind} for native ${native.marketingVersion} (${native.buildNumber}).`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import {
assertBuildEncodesVersion,
assertUnusedStoreBuild,
buildOutputLines,
classifyRelease,
compareRelease,
Expand Down Expand Up @@ -75,6 +76,35 @@ describe('previous release selection', () => {
);
});

it('uses the previous stable release for a stable promotion', () => {
const tags = ['v9.0.0', 'v9.1.0-1'];
const previousTag = selectPreviousTag(tags, {
currentTag: '9.1.0',
currentMatch: match('9.1.0'),
containsAppPackage: () => true,
});
assert.equal(previousTag, 'v9.0.0');
assert.equal(
classifyRelease(
classification({
tagMatch: match('9.1.0'),
native: { marketingVersion: '9.1.0', buildNumber: '9010000' },
previousTag,
previousMatch: parseReleaseTag(previousTag),
}),
),
'store',
);
assert.equal(
selectPreviousTag(tags, {
currentTag: '9.1.0-2',
currentMatch: match('9.1.0-2'),
containsAppPackage: () => true,
}),
'v9.1.0-1',
);
});

it('returns undefined for the first applicable release', () => {
assert.equal(
selectPreviousTag(['v9.0.0'], {
Expand Down Expand Up @@ -252,6 +282,18 @@ describe('release classification', () => {
});
});

describe('native handoff build numbers', () => {
it('requires a store build above every prior handoff in its release train', () => {
const handoffs = [
{ tag: 'capawesome/v9.1.0-1', buildNumber: '9010001' },
{ tag: 'capawesome/v9.1.0-2', buildNumber: '9010002' },
];
assert.throws(() => assertUnusedStoreBuild('9010002', handoffs), /already handed off by capawesome\/v9\.1\.0-2/);
assert.throws(() => assertUnusedStoreBuild('9010000', handoffs), /must exceed 9010001/);
assert.doesNotThrow(() => assertUnusedStoreBuild('9010003', handoffs));
});
});

describe('action outputs', () => {
it('emits the routing and existing Live Update outputs', () => {
assert.deepEqual(buildOutputLines('live-update', '9.0.1', '9000000'), [
Expand Down