mirror of
https://github.com/expo/expo-github-action.git
synced 2026-11-15 17:32:45 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1176352a0b |
No files matched your search
+1
-1
@@ -3,4 +3,4 @@
|
||||
* text=auto
|
||||
|
||||
# These files are text and should be normalized (Convert crlf => lf)
|
||||
build/** text eol=lf
|
||||
build/** text eol=lf linguist-generated=true
|
||||
+20
-6
@@ -44535,6 +44535,7 @@ function collectContinuousDeployFingerprintInput() {
|
||||
exports.collectContinuousDeployFingerprintInput = collectContinuousDeployFingerprintInput;
|
||||
(0, worker_1.executeAction)(continuousDeployFingerprintAction);
|
||||
async function continuousDeployFingerprintAction(input = collectContinuousDeployFingerprintInput()) {
|
||||
const isInPullRequest = (0, github_1.hasPullContext)();
|
||||
const config = await (0, project_1.loadProjectConfig)(input.workingDirectory);
|
||||
const projectId = config.extra?.eas?.projectId;
|
||||
if (!projectId) {
|
||||
@@ -44553,6 +44554,7 @@ async function continuousDeployFingerprintAction(input = collectContinuousDeploy
|
||||
platform: 'android',
|
||||
profile: input.profile,
|
||||
fingerprintHash: androidFingerprintHash,
|
||||
excludeExpiredBuilds: isInPullRequest,
|
||||
});
|
||||
if (androidBuildInfo) {
|
||||
(0, core_1.info)(`Existing Android build found with matching fingerprint: ${androidBuildInfo.id}`);
|
||||
@@ -44570,6 +44572,7 @@ async function continuousDeployFingerprintAction(input = collectContinuousDeploy
|
||||
platform: 'ios',
|
||||
profile: input.profile,
|
||||
fingerprintHash: iosFingerprintHash,
|
||||
excludeExpiredBuilds: isInPullRequest,
|
||||
});
|
||||
if (iosBuildInfo) {
|
||||
(0, core_1.info)(`Existing iOS build found with matching fingerprint: ${iosBuildInfo.id}`);
|
||||
@@ -44584,7 +44587,7 @@ async function continuousDeployFingerprintAction(input = collectContinuousDeploy
|
||||
cwd: input.workingDirectory,
|
||||
branch: input.branch,
|
||||
});
|
||||
if (!(0, github_1.hasPullContext)()) {
|
||||
if (!isInPullRequest) {
|
||||
(0, core_1.info)(`Skipped comment: action was not run from a pull request`);
|
||||
}
|
||||
else {
|
||||
@@ -44621,7 +44624,7 @@ async function getFingerprintHashForPlatformAsync({ cwd, platform, }) {
|
||||
throw new Error(`Could not get fingerprint for project: ${String(error)}`);
|
||||
}
|
||||
}
|
||||
async function getBuildInfoWithFingerprintAsync({ cwd, platform, profile, fingerprintHash, }) {
|
||||
async function getBuildInfoWithFingerprintAsync({ cwd, platform, profile, fingerprintHash, excludeExpiredBuilds, }) {
|
||||
let stdout;
|
||||
try {
|
||||
const execOutput = await (0, exec_1.getExecOutput)(await (0, io_1.which)('eas', true), [
|
||||
@@ -44654,7 +44657,17 @@ async function getBuildInfoWithFingerprintAsync({ cwd, platform, profile, finger
|
||||
if (!builds[0]) {
|
||||
return null;
|
||||
}
|
||||
return builds[0];
|
||||
const build = builds[0];
|
||||
if (excludeExpiredBuilds) {
|
||||
// if the build is expired or will expire within the next day,
|
||||
// return null to trigger a new build
|
||||
const tomorrow = new Date();
|
||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
if (tomorrow > new Date(build.expirationDate)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return build;
|
||||
}
|
||||
async function createEASBuildAsync({ cwd, profile, platform, }) {
|
||||
let stdout;
|
||||
@@ -44672,12 +44685,13 @@ async function createEASBuildAsync({ cwd, profile, platform, }) {
|
||||
return JSON.parse(stdout)[0];
|
||||
}
|
||||
async function publishEASUpdatesAsync({ cwd, branch }) {
|
||||
let stdout = '';
|
||||
let stdout;
|
||||
try {
|
||||
({ stdout } = await (0, exec_1.getExecOutput)(await (0, io_1.which)('eas', true), ['update', '--auto', '--branch', branch, '--non-interactive', '--json'], {
|
||||
const execOutput = await (0, exec_1.getExecOutput)(await (0, io_1.which)('eas', true), ['update', '--auto', '--branch', branch, '--non-interactive', '--json'], {
|
||||
cwd,
|
||||
silent: !(0, core_1.isDebug)(),
|
||||
}));
|
||||
});
|
||||
stdout = execOutput.stdout;
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Could not create a new EAS Update: ${String(error)}`);
|
||||
|
||||
@@ -22,6 +22,8 @@ export function collectContinuousDeployFingerprintInput() {
|
||||
executeAction(continuousDeployFingerprintAction);
|
||||
|
||||
export async function continuousDeployFingerprintAction(input = collectContinuousDeployFingerprintInput()) {
|
||||
const isInPullRequest = hasPullContext();
|
||||
|
||||
const config = await loadProjectConfig(input.workingDirectory);
|
||||
const projectId = config.extra?.eas?.projectId;
|
||||
if (!projectId) {
|
||||
@@ -44,6 +46,7 @@ export async function continuousDeployFingerprintAction(input = collectContinuou
|
||||
platform: 'android',
|
||||
profile: input.profile,
|
||||
fingerprintHash: androidFingerprintHash,
|
||||
excludeExpiredBuilds: isInPullRequest,
|
||||
});
|
||||
if (androidBuildInfo) {
|
||||
info(`Existing Android build found with matching fingerprint: ${androidBuildInfo.id}`);
|
||||
@@ -61,6 +64,7 @@ export async function continuousDeployFingerprintAction(input = collectContinuou
|
||||
platform: 'ios',
|
||||
profile: input.profile,
|
||||
fingerprintHash: iosFingerprintHash,
|
||||
excludeExpiredBuilds: isInPullRequest,
|
||||
});
|
||||
if (iosBuildInfo) {
|
||||
info(`Existing iOS build found with matching fingerprint: ${iosBuildInfo.id}`);
|
||||
@@ -78,7 +82,7 @@ export async function continuousDeployFingerprintAction(input = collectContinuou
|
||||
branch: input.branch,
|
||||
});
|
||||
|
||||
if (!hasPullContext()) {
|
||||
if (!isInPullRequest) {
|
||||
info(`Skipped comment: action was not run from a pull request`);
|
||||
} else {
|
||||
const messageId = `continuous-deploy-fingerprint-projectId:${projectId}`;
|
||||
@@ -131,13 +135,15 @@ async function getBuildInfoWithFingerprintAsync({
|
||||
platform,
|
||||
profile,
|
||||
fingerprintHash,
|
||||
excludeExpiredBuilds,
|
||||
}: {
|
||||
cwd: string;
|
||||
platform: 'ios' | 'android';
|
||||
profile: string;
|
||||
fingerprintHash: string;
|
||||
excludeExpiredBuilds: boolean;
|
||||
}): Promise<BuildInfo | null> {
|
||||
let stdout;
|
||||
let stdout: string;
|
||||
try {
|
||||
const execOutput = await getExecOutput(
|
||||
await which('eas', true),
|
||||
@@ -175,7 +181,19 @@ async function getBuildInfoWithFingerprintAsync({
|
||||
return null;
|
||||
}
|
||||
|
||||
return builds[0];
|
||||
const build = builds[0] as BuildInfo;
|
||||
|
||||
if (excludeExpiredBuilds) {
|
||||
// if the build is expired or will expire within the next day,
|
||||
// return null to trigger a new build
|
||||
const tomorrow = new Date();
|
||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
if (tomorrow > new Date(build.expirationDate)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return build;
|
||||
}
|
||||
|
||||
async function createEASBuildAsync({
|
||||
@@ -187,7 +205,7 @@ async function createEASBuildAsync({
|
||||
profile: string;
|
||||
platform: 'ios' | 'android';
|
||||
}): Promise<BuildInfo> {
|
||||
let stdout;
|
||||
let stdout: string;
|
||||
try {
|
||||
const extraArgs = isDebug() ? ['--build-logger-level', 'debug'] : [];
|
||||
const execOutput = await getExecOutput(
|
||||
@@ -207,17 +225,17 @@ async function createEASBuildAsync({
|
||||
}
|
||||
|
||||
async function publishEASUpdatesAsync({ cwd, branch }: { cwd: string; branch: string }): Promise<EasUpdate[]> {
|
||||
let stdout = '';
|
||||
|
||||
let stdout: string;
|
||||
try {
|
||||
({ stdout } = await getExecOutput(
|
||||
const execOutput = await getExecOutput(
|
||||
await which('eas', true),
|
||||
['update', '--auto', '--branch', branch, '--non-interactive', '--json'],
|
||||
{
|
||||
cwd,
|
||||
silent: !isDebug(),
|
||||
}
|
||||
));
|
||||
);
|
||||
stdout = execOutput.stdout;
|
||||
} catch (error: unknown) {
|
||||
throw new Error(`Could not create a new EAS Update: ${String(error)}`);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ export type BuildInfo = {
|
||||
sdkVersion: string;
|
||||
appVersion: string;
|
||||
gitCommitHash: string;
|
||||
expirationDate: string;
|
||||
};
|
||||
|
||||
export const appPlatformDisplayNames: Record<AppPlatform, string> = {
|
||||
|
||||
Reference in new issue
Block a user