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,28 +0,0 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['universe/node'],
|
||||
ignorePatterns: ['build/**', 'node_modules/**'],
|
||||
rules: {
|
||||
'prettier/prettier': 'error',
|
||||
'sort-imports': [
|
||||
'warn',
|
||||
{
|
||||
ignoreDeclarationSort: true,
|
||||
},
|
||||
],
|
||||
curly: 'warn',
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.ts', '*.tsx', '*.d.ts'],
|
||||
extends: ['universe/shared/typescript-analysis'],
|
||||
excludedFiles: ['**/tests/**'],
|
||||
parserOptions: {
|
||||
project: './tsconfig.json',
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/prefer-nullish-coalescing': ['warn', { ignorePrimitives: true }],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -33,7 +33,7 @@
|
||||
## What's inside?
|
||||
|
||||
With this Expo action, you have full access to [Expo CLI][link-expo-cli] and [EAS CLI][link-eas-cli].
|
||||
It lets you automate the `eas update` or `eas build` commands, leaving you with more time to work on your project.
|
||||
It lets you automate the `expo publish` or `eas build` commands, leaving you with more time to work on your project.
|
||||
Some additional features are included to make the usage of this action as simple as possible, like caching and authentication.
|
||||
|
||||
## Configuration options
|
||||
@@ -45,6 +45,8 @@ Here is a summary of all the input options you can use.
|
||||
|
||||
| variable | default | description |
|
||||
| ------------------ | ------- | --------------------------------------------------------------------------------------------- |
|
||||
| **expo-version** | - | Expo CLI version to install _(skips when omitted)_ |
|
||||
| **expo-cache** | `true` | If it should use the GitHub actions cache ([read more](#using-the-built-in-cache)) |
|
||||
| **eas-version** | - | EAS CLI version to install _(skips when omitted)_ |
|
||||
| **eas-cache** | `true` | If it should use the GitHub actions cache ([read more](#using-the-built-in-cache)) |
|
||||
| **packager** | `yarn` | Package manager to use _(e.g. `bun`, `yarn`, or `npm`)_ |
|
||||
@@ -173,7 +175,7 @@ jobs:
|
||||
uses: expo/expo-github-action/preview@v8
|
||||
with:
|
||||
# `github.event.pull_request.head.ref` is only available on `pull_request` triggers.
|
||||
# Use your own, or keep the automatically inferred branch name from `--auto`, when using different triggers.
|
||||
# Use your own, or keep the automatically infered branch name from `--auto`, when using different triggers.
|
||||
command: eas update --auto --branch ${{ github.event.pull_request.head.ref }}
|
||||
```
|
||||
|
||||
|
||||
Generated
+8
-16
@@ -38699,7 +38699,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectAppType = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.BuildStatus = exports.AppPlatform = void 0;
|
||||
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectAppType = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.AppPlatform = void 0;
|
||||
const core_1 = __nccwpck_require__(2186);
|
||||
const exec_1 = __nccwpck_require__(1514);
|
||||
const io_1 = __nccwpck_require__(7436);
|
||||
@@ -38711,16 +38711,6 @@ var AppPlatform;
|
||||
AppPlatform["Android"] = "ANDROID";
|
||||
AppPlatform["Ios"] = "IOS";
|
||||
})(AppPlatform || (exports.AppPlatform = AppPlatform = {}));
|
||||
var BuildStatus;
|
||||
(function (BuildStatus) {
|
||||
BuildStatus["New"] = "NEW";
|
||||
BuildStatus["InQueue"] = "IN_QUEUE";
|
||||
BuildStatus["InProgress"] = "IN_PROGRESS";
|
||||
BuildStatus["PendingCancel"] = "PENDING_CANCEL";
|
||||
BuildStatus["Errored"] = "ERRORED";
|
||||
BuildStatus["Finished"] = "FINISHED";
|
||||
BuildStatus["Canceled"] = "CANCELED";
|
||||
})(BuildStatus || (exports.BuildStatus = BuildStatus = {}));
|
||||
exports.appPlatformDisplayNames = {
|
||||
[AppPlatform.Android]: 'Android',
|
||||
[AppPlatform.Ios]: 'iOS',
|
||||
@@ -38898,8 +38888,7 @@ function projectAppType(dir) {
|
||||
catch (error) {
|
||||
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
|
||||
}
|
||||
if (packageJson?.dependencies?.['expo-dev-client'] ||
|
||||
packageJson?.devDependencies?.['expo-dev-client']) {
|
||||
if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
|
||||
return 'dev-build';
|
||||
}
|
||||
return 'expo-go';
|
||||
@@ -38944,10 +38933,13 @@ function projectDeepLink(project, channel) {
|
||||
}
|
||||
exports.projectDeepLink = projectDeepLink;
|
||||
function getBuildLogsUrl(build) {
|
||||
// TODO: reuse this function from the original source
|
||||
// see: https://github.com/expo/eas-cli/blob/896f7f038582347c57dc700be9ea7d092b5a3a21/packages/eas-cli/src/build/utils/url.ts#L13-L21
|
||||
const { project } = build;
|
||||
const path = `/accounts/${project.ownerAccount.name}/projects/${project.slug}/builds/${build.id}`;
|
||||
const baseUrl = process.env.EXPO_STAGING ? 'staging.expo.dev' : 'expo.dev';
|
||||
const url = new url_1.URL(path, `https://${baseUrl}`);
|
||||
const path = project
|
||||
? `/accounts/${project.ownerAccount.name}/projects/${project.slug}/builds/${build.id}`
|
||||
: `/builds/${build.id}`;
|
||||
const url = new url_1.URL(path, 'https://expo.dev');
|
||||
return url.toString();
|
||||
}
|
||||
exports.getBuildLogsUrl = getBuildLogsUrl;
|
||||
|
||||
-31059
File diff suppressed because it is too large.
Load diff
-175
@@ -1,175 +0,0 @@
|
||||
@actions/core
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@actions/exec
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@actions/http-client
|
||||
MIT
|
||||
Actions Http Client for Node.js
|
||||
|
||||
Copyright (c) GitHub, Inc.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
@actions/io
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@actions/tool-cache
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@fastify/busboy
|
||||
MIT
|
||||
Copyright Brian White. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
|
||||
semver
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
tunnel
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2012 Koichi Kobayashi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
undici
|
||||
MIT
|
||||
MIT License
|
||||
|
||||
Copyright (c) Matteo Collina and Undici contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
uuid
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2010-2020 Robert Kieffer and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+155
-319
@@ -41909,7 +41909,7 @@ async function assertEasVersion(versionRange) {
|
||||
throw new Error(`Could not verify the EAS CLI version, reason:\nCommand failed 'eas --version'`);
|
||||
}
|
||||
const version = stdout.match(/eas-cli\/([^\s]+)/i);
|
||||
if (!version?.[1]) {
|
||||
if (!version || !version[1]) {
|
||||
throw new Error(`Could not verify the EAS CLI version, reason:\nUnexpected output received.`);
|
||||
}
|
||||
if (!semver_1.default.satisfies(version[1], versionRange)) {
|
||||
@@ -41945,9 +41945,6 @@ function getUpdateGroupQr({ projectId, updateGroupId, appSlug, qrTarget, }) {
|
||||
// See: https://github.com/expo/expo/blob/8ae75dde393e5d2393d446227a1fe2482c75eec3/packages/expo-dev-client/plugin/src/getDefaultScheme.ts#L17
|
||||
url.searchParams.append('appScheme', appSlug.replace(/[^A-Za-z0-9+\-.]/g, ''));
|
||||
}
|
||||
if (process.env.EXPO_STAGING) {
|
||||
url.searchParams.append('host', 'staging-u.expo.dev');
|
||||
}
|
||||
url.searchParams.append('projectId', projectId);
|
||||
url.searchParams.append('groupId', updateGroupId);
|
||||
return url.toString();
|
||||
@@ -41955,8 +41952,7 @@ function getUpdateGroupQr({ projectId, updateGroupId, appSlug, qrTarget, }) {
|
||||
exports.getUpdateGroupQr = getUpdateGroupQr;
|
||||
/** Create the absolute link to the update group on expo.dev */
|
||||
function getUpdateGroupWebsite({ projectId, updateGroupId, }) {
|
||||
const baseUrl = process.env.EXPO_STAGING ? 'staging.expo.dev' : 'expo.dev';
|
||||
return `https://${baseUrl}/projects/${projectId}/updates/${updateGroupId}`;
|
||||
return `https://expo.dev/projects/${projectId}/updates/${updateGroupId}`;
|
||||
}
|
||||
exports.getUpdateGroupWebsite = getUpdateGroupWebsite;
|
||||
|
||||
@@ -41972,7 +41968,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectAppType = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.BuildStatus = exports.AppPlatform = void 0;
|
||||
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectAppType = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.AppPlatform = void 0;
|
||||
const core_1 = __nccwpck_require__(2186);
|
||||
const exec_1 = __nccwpck_require__(1514);
|
||||
const io_1 = __nccwpck_require__(7436);
|
||||
@@ -41984,16 +41980,6 @@ var AppPlatform;
|
||||
AppPlatform["Android"] = "ANDROID";
|
||||
AppPlatform["Ios"] = "IOS";
|
||||
})(AppPlatform || (exports.AppPlatform = AppPlatform = {}));
|
||||
var BuildStatus;
|
||||
(function (BuildStatus) {
|
||||
BuildStatus["New"] = "NEW";
|
||||
BuildStatus["InQueue"] = "IN_QUEUE";
|
||||
BuildStatus["InProgress"] = "IN_PROGRESS";
|
||||
BuildStatus["PendingCancel"] = "PENDING_CANCEL";
|
||||
BuildStatus["Errored"] = "ERRORED";
|
||||
BuildStatus["Finished"] = "FINISHED";
|
||||
BuildStatus["Canceled"] = "CANCELED";
|
||||
})(BuildStatus || (exports.BuildStatus = BuildStatus = {}));
|
||||
exports.appPlatformDisplayNames = {
|
||||
[AppPlatform.Android]: 'Android',
|
||||
[AppPlatform.Ios]: 'iOS',
|
||||
@@ -42171,8 +42157,7 @@ function projectAppType(dir) {
|
||||
catch (error) {
|
||||
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
|
||||
}
|
||||
if (packageJson?.dependencies?.['expo-dev-client'] ||
|
||||
packageJson?.devDependencies?.['expo-dev-client']) {
|
||||
if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
|
||||
return 'dev-build';
|
||||
}
|
||||
return 'expo-go';
|
||||
@@ -42217,130 +42202,18 @@ function projectDeepLink(project, channel) {
|
||||
}
|
||||
exports.projectDeepLink = projectDeepLink;
|
||||
function getBuildLogsUrl(build) {
|
||||
// TODO: reuse this function from the original source
|
||||
// see: https://github.com/expo/eas-cli/blob/896f7f038582347c57dc700be9ea7d092b5a3a21/packages/eas-cli/src/build/utils/url.ts#L13-L21
|
||||
const { project } = build;
|
||||
const path = `/accounts/${project.ownerAccount.name}/projects/${project.slug}/builds/${build.id}`;
|
||||
const baseUrl = process.env.EXPO_STAGING ? 'staging.expo.dev' : 'expo.dev';
|
||||
const url = new url_1.URL(path, `https://${baseUrl}`);
|
||||
const path = project
|
||||
? `/accounts/${project.ownerAccount.name}/projects/${project.slug}/builds/${build.id}`
|
||||
: `/builds/${build.id}`;
|
||||
const url = new url_1.URL(path, 'https://expo.dev');
|
||||
return url.toString();
|
||||
}
|
||||
exports.getBuildLogsUrl = getBuildLogsUrl;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3177:
|
||||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getBuildInfoWithFingerprintAsync = exports.getBuildInfoForCurrentFingerprintAsync = void 0;
|
||||
const core_1 = __nccwpck_require__(2186);
|
||||
const exec_1 = __nccwpck_require__(1514);
|
||||
const io_1 = __nccwpck_require__(7436);
|
||||
const expo_1 = __nccwpck_require__(2489);
|
||||
async function getBuildInfoForCurrentFingerprintAsync({ platform, workingDirectory, environment, profile, isInPullRequest, }) {
|
||||
const humanReadablePlatformName = platform === 'ios' ? 'iOS' : 'Android';
|
||||
const fingerprintHash = await getFingerprintHashForPlatformAsync({
|
||||
cwd: workingDirectory,
|
||||
platform,
|
||||
environment,
|
||||
});
|
||||
(0, core_1.info)(`${humanReadablePlatformName} fingerprint: ${fingerprintHash}`);
|
||||
(0, core_1.info)(`Looking for ${humanReadablePlatformName} builds with matching runtime version (fingerprint)...`);
|
||||
return {
|
||||
buildInfo: await getBuildInfoWithFingerprintAsync({
|
||||
cwd: workingDirectory,
|
||||
platform,
|
||||
profile,
|
||||
fingerprintHash,
|
||||
excludeExpiredBuilds: isInPullRequest,
|
||||
}),
|
||||
fingerprintHash,
|
||||
};
|
||||
}
|
||||
exports.getBuildInfoForCurrentFingerprintAsync = getBuildInfoForCurrentFingerprintAsync;
|
||||
async function getFingerprintHashForPlatformAsync({ cwd, platform, environment, }) {
|
||||
let hash;
|
||||
try {
|
||||
const extraArgs = (0, core_1.isDebug)() ? ['--debug'] : [];
|
||||
const baseArguments = [
|
||||
'expo-updates',
|
||||
'fingerprint:generate',
|
||||
'--platform',
|
||||
platform,
|
||||
...extraArgs,
|
||||
];
|
||||
let commandLine;
|
||||
let args;
|
||||
if (environment) {
|
||||
commandLine = await (0, io_1.which)('eas', true);
|
||||
const commandToExecute = ['npx', ...baseArguments].join(' ').replace(/"/g, '\\"');
|
||||
args = ['env:exec', '--non-interactive', environment, `"${commandToExecute}"`];
|
||||
}
|
||||
else {
|
||||
commandLine = 'npx';
|
||||
args = baseArguments;
|
||||
}
|
||||
const { stdout } = await (0, exec_1.getExecOutput)(commandLine, args, {
|
||||
cwd,
|
||||
silent: !(0, core_1.isDebug)(),
|
||||
});
|
||||
hash = JSON.parse(stdout);
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Error calculating fingerprint: ${String(error)}`, { cause: error });
|
||||
}
|
||||
if (!hash || typeof hash !== 'string') {
|
||||
throw new Error(`Invalid fingerprint hash: ${hash}`);
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
async function getBuildInfoWithFingerprintAsync({ cwd, platform, profile, fingerprintHash, excludeExpiredBuilds, }) {
|
||||
let builds;
|
||||
try {
|
||||
const { stdout } = await (0, exec_1.getExecOutput)(await (0, io_1.which)('eas', true), [
|
||||
'build:list',
|
||||
'--platform',
|
||||
platform,
|
||||
'--buildProfile',
|
||||
profile,
|
||||
'--runtimeVersion',
|
||||
fingerprintHash,
|
||||
'--limit',
|
||||
'1',
|
||||
'--json',
|
||||
'--non-interactive',
|
||||
], {
|
||||
cwd,
|
||||
silent: !(0, core_1.isDebug)(),
|
||||
});
|
||||
builds = JSON.parse(stdout).builds;
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Error getting EAS builds: ${String(error)}`, { cause: error });
|
||||
}
|
||||
if (!builds || !Array.isArray(builds)) {
|
||||
throw new Error(`Could not get EAS builds for project`);
|
||||
}
|
||||
const tomorrow = new Date();
|
||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
const buildsThatAreValid = builds.filter(build => {
|
||||
const isValidStatus = [
|
||||
expo_1.BuildStatus.New,
|
||||
expo_1.BuildStatus.InQueue,
|
||||
expo_1.BuildStatus.InProgress,
|
||||
expo_1.BuildStatus.Finished,
|
||||
].includes(build.status);
|
||||
// if the build is expired or will expire within the next day,
|
||||
const isValidExpiry = excludeExpiredBuilds ? new Date(build.expirationDate) > tomorrow : true;
|
||||
return isValidStatus && isValidExpiry;
|
||||
});
|
||||
return buildsThatAreValid[0] ?? null;
|
||||
}
|
||||
exports.getBuildInfoWithFingerprintAsync = getBuildInfoWithFingerprintAsync;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 978:
|
||||
@@ -42507,29 +42380,6 @@ async function getPullRequestFromGitCommitShaAsync(options, gitCommitHash) {
|
||||
exports.getPullRequestFromGitCommitShaAsync = getPullRequestFromGitCommitShaAsync;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6747:
|
||||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getInput = void 0;
|
||||
const core_1 = __nccwpck_require__(2186);
|
||||
function getInput(name, options) {
|
||||
const value = (0, core_1.getInput)(name, options);
|
||||
if (!value) {
|
||||
if (options?.required) {
|
||||
throw new Error(`Input ${name} is required.`);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
exports.getInput = getInput;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7191:
|
||||
@@ -42539,32 +42389,18 @@ exports.getInput = getInput;
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.loadProjectConfig = void 0;
|
||||
const core_1 = __nccwpck_require__(2186);
|
||||
const exec_1 = __nccwpck_require__(1514);
|
||||
const io_1 = __nccwpck_require__(7436);
|
||||
/**
|
||||
* Load the Expo app project config in the given directory.
|
||||
* This runs `expo config` command instead of using `@expo/config` directly,
|
||||
* to use the app's own version of the config.
|
||||
*/
|
||||
async function loadProjectConfig(cwd, easEnvironment) {
|
||||
async function loadProjectConfig(cwd) {
|
||||
let stdout = '';
|
||||
const baseArguments = ['expo', 'config', '--json', '--type', 'public'];
|
||||
let commandLine;
|
||||
let args;
|
||||
if (easEnvironment) {
|
||||
commandLine = await (0, io_1.which)('eas', true);
|
||||
const commandToExecute = ['npx', ...baseArguments].join(' ').replace(/"/g, '\\"');
|
||||
args = ['env:exec', '--non-interactive', easEnvironment, `"${commandToExecute}"`];
|
||||
}
|
||||
else {
|
||||
commandLine = 'npx';
|
||||
args = baseArguments;
|
||||
}
|
||||
try {
|
||||
({ stdout } = await (0, exec_1.getExecOutput)(commandLine, args, {
|
||||
({ stdout } = await (0, exec_1.getExecOutput)('npx', ['expo', 'config', '--json', '--type', 'public'], {
|
||||
cwd,
|
||||
silent: !(0, core_1.isDebug)(),
|
||||
silent: true,
|
||||
}));
|
||||
}
|
||||
catch (error) {
|
||||
@@ -44685,83 +44521,78 @@ const io_1 = __nccwpck_require__(7436);
|
||||
const comment_1 = __nccwpck_require__(7810);
|
||||
const eas_1 = __nccwpck_require__(3251);
|
||||
const expo_1 = __nccwpck_require__(2489);
|
||||
const fingerprintUtils_1 = __nccwpck_require__(3177);
|
||||
const github_1 = __nccwpck_require__(978);
|
||||
const input_1 = __nccwpck_require__(6747);
|
||||
const project_1 = __nccwpck_require__(7191);
|
||||
const worker_1 = __nccwpck_require__(8912);
|
||||
function collectContinuousDeployFingerprintInput() {
|
||||
function validatePlatformInput(platformInput) {
|
||||
return ['android', 'ios', 'all'].includes(platformInput);
|
||||
}
|
||||
const platformInput = (0, input_1.getInput)('platform', { required: true });
|
||||
if (!validatePlatformInput(platformInput)) {
|
||||
throw new Error(`Invalid platform: ${platformInput}. Must be one of "all", "ios", "android".`);
|
||||
}
|
||||
return {
|
||||
profile: (0, input_1.getInput)('profile', { required: true }),
|
||||
branch: (0, input_1.getInput)('branch', { required: true }),
|
||||
platform: platformInput,
|
||||
environment: (0, input_1.getInput)('environment'),
|
||||
autoSubmitBuilds: (0, input_1.getInput)('auto-submit-builds') === 'true',
|
||||
githubToken: (0, input_1.getInput)('github-token', { required: true }),
|
||||
workingDirectory: (0, input_1.getInput)('working-directory', { required: true }),
|
||||
profile: (0, core_1.getInput)('profile'),
|
||||
branch: (0, core_1.getInput)('branch'),
|
||||
githubToken: (0, core_1.getInput)('github-token'),
|
||||
workingDirectory: (0, core_1.getInput)('working-directory'),
|
||||
};
|
||||
}
|
||||
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, input.environment);
|
||||
const config = await (0, project_1.loadProjectConfig)(input.workingDirectory);
|
||||
const projectId = config.extra?.eas?.projectId;
|
||||
if (!projectId) {
|
||||
return (0, core_1.setFailed)(`Missing 'extra.eas.projectId' in app.json or app.config.js.`);
|
||||
}
|
||||
const platformsToRun = input.platform === 'all' ? new Set(['ios', 'android']) : new Set([input.platform]);
|
||||
const [androidBuildRunInfo, iosBuildRunInfo] = await Promise.all([
|
||||
platformsToRun.has('android')
|
||||
? buildForPlatformIfNecessaryAsync({
|
||||
platform: 'android',
|
||||
profile: input.profile,
|
||||
workingDirectory: input.workingDirectory,
|
||||
isInPullRequest,
|
||||
environment: input.environment,
|
||||
autoSubmitBuild: input.autoSubmitBuilds,
|
||||
})
|
||||
: null,
|
||||
platformsToRun.has('ios')
|
||||
? buildForPlatformIfNecessaryAsync({
|
||||
platform: 'ios',
|
||||
profile: input.profile,
|
||||
workingDirectory: input.workingDirectory,
|
||||
isInPullRequest,
|
||||
environment: input.environment,
|
||||
autoSubmitBuild: input.autoSubmitBuilds,
|
||||
})
|
||||
: null,
|
||||
]);
|
||||
const androidFingerprintHash = await getFingerprintHashForPlatformAsync({
|
||||
cwd: input.workingDirectory,
|
||||
platform: 'android',
|
||||
});
|
||||
const iosFingerprintHash = await getFingerprintHashForPlatformAsync({ cwd: input.workingDirectory, platform: 'ios' });
|
||||
(0, core_1.info)(`Android fingerprint: ${androidFingerprintHash}`);
|
||||
(0, core_1.info)(`iOS fingerprint: ${iosFingerprintHash}`);
|
||||
(0, core_1.info)('Looking for builds with matching runtime version (fingerprint)...');
|
||||
let androidBuildInfo = await getBuildInfoWithFingerprintAsync({
|
||||
cwd: input.workingDirectory,
|
||||
platform: 'android',
|
||||
profile: input.profile,
|
||||
fingerprintHash: androidFingerprintHash,
|
||||
excludeExpiredBuilds: isInPullRequest,
|
||||
});
|
||||
if (androidBuildInfo) {
|
||||
(0, core_1.info)(`Existing Android build found with matching fingerprint: ${androidBuildInfo.id}`);
|
||||
}
|
||||
else {
|
||||
(0, core_1.info)(`No existing Android build found for fingerprint, starting a new build...`);
|
||||
androidBuildInfo = await createEASBuildAsync({
|
||||
cwd: input.workingDirectory,
|
||||
platform: 'android',
|
||||
profile: input.profile,
|
||||
});
|
||||
}
|
||||
let iosBuildInfo = await getBuildInfoWithFingerprintAsync({
|
||||
cwd: input.workingDirectory,
|
||||
platform: 'ios',
|
||||
profile: input.profile,
|
||||
fingerprintHash: iosFingerprintHash,
|
||||
excludeExpiredBuilds: isInPullRequest,
|
||||
});
|
||||
if (iosBuildInfo) {
|
||||
(0, core_1.info)(`Existing iOS build found with matching fingerprint: ${iosBuildInfo.id}`);
|
||||
}
|
||||
else {
|
||||
(0, core_1.info)(`No existing iOS build found for fingerprint, starting a new build...`);
|
||||
iosBuildInfo = await createEASBuildAsync({ cwd: input.workingDirectory, platform: 'ios', profile: input.profile });
|
||||
}
|
||||
const builds = [androidBuildInfo, iosBuildInfo];
|
||||
(0, core_1.info)(`Publishing EAS Update...`);
|
||||
const updates = await publishEASUpdatesAsync({
|
||||
cwd: input.workingDirectory,
|
||||
branch: input.branch,
|
||||
platform: input.platform,
|
||||
environment: input.environment,
|
||||
});
|
||||
if (!isInPullRequest) {
|
||||
(0, core_1.info)(`Skipped comment: action was not run from a pull request`);
|
||||
}
|
||||
else {
|
||||
const messageId = `continuous-deploy-fingerprint-projectId:${projectId}`;
|
||||
const messageBody = createSummaryForUpdatesAndBuilds({
|
||||
config,
|
||||
projectId,
|
||||
updates,
|
||||
buildRunInfos: {
|
||||
androidBuildRunInfo: androidBuildRunInfo ?? undefined,
|
||||
iosBuildRunInfo: iosBuildRunInfo ?? undefined,
|
||||
},
|
||||
options: input,
|
||||
});
|
||||
const messageBody = createSummaryForUpdatesAndBuilds({ config, projectId, updates, builds, options: input });
|
||||
await (0, github_1.createIssueComment)({
|
||||
...(0, github_1.pullContext)(),
|
||||
token: input.githubToken,
|
||||
@@ -44769,123 +44600,130 @@ async function continuousDeployFingerprintAction(input = collectContinuousDeploy
|
||||
body: messageBody,
|
||||
});
|
||||
}
|
||||
(0, core_1.setOutput)('android-fingerprint', androidBuildRunInfo?.fingerprintHash);
|
||||
(0, core_1.setOutput)('ios-fingerprint', iosBuildRunInfo?.fingerprintHash);
|
||||
(0, core_1.setOutput)('android-build-id', androidBuildRunInfo?.buildInfo.id);
|
||||
(0, core_1.setOutput)('android-did-start-new-build', androidBuildRunInfo?.isNew);
|
||||
(0, core_1.setOutput)('ios-build-id', iosBuildRunInfo?.buildInfo?.id);
|
||||
(0, core_1.setOutput)('ios-did-start-new-build', iosBuildRunInfo?.isNew);
|
||||
(0, core_1.setOutput)('android-fingerprint', androidFingerprintHash);
|
||||
(0, core_1.setOutput)('ios-fingerprint', iosFingerprintHash);
|
||||
(0, core_1.setOutput)('android-build-id', androidBuildInfo.id);
|
||||
(0, core_1.setOutput)('ios-build-id', iosBuildInfo.id);
|
||||
(0, core_1.setOutput)('update-output', updates);
|
||||
}
|
||||
exports.continuousDeployFingerprintAction = continuousDeployFingerprintAction;
|
||||
async function buildForPlatformIfNecessaryAsync({ platform, workingDirectory, profile, isInPullRequest, environment, autoSubmitBuild, }) {
|
||||
const humanReadablePlatformName = platform === 'ios' ? 'iOS' : 'Android';
|
||||
const { buildInfo: existingBuildInfo, fingerprintHash } = await (0, fingerprintUtils_1.getBuildInfoForCurrentFingerprintAsync)({
|
||||
workingDirectory,
|
||||
platform,
|
||||
profile,
|
||||
isInPullRequest,
|
||||
environment,
|
||||
});
|
||||
if (existingBuildInfo) {
|
||||
(0, core_1.info)(`Existing ${humanReadablePlatformName} build found with matching fingerprint: ${existingBuildInfo.id}`);
|
||||
return {
|
||||
buildInfo: existingBuildInfo,
|
||||
isNew: false,
|
||||
fingerprintHash,
|
||||
};
|
||||
}
|
||||
else {
|
||||
(0, core_1.info)(`No existing ${humanReadablePlatformName} build found for fingerprint, starting a new build...`);
|
||||
return {
|
||||
buildInfo: await createEASBuildAsync({
|
||||
cwd: workingDirectory,
|
||||
platform,
|
||||
profile,
|
||||
autoSubmit: autoSubmitBuild,
|
||||
}),
|
||||
isNew: true,
|
||||
fingerprintHash,
|
||||
};
|
||||
}
|
||||
}
|
||||
async function createEASBuildAsync({ cwd, profile, platform, autoSubmit, }) {
|
||||
async function getFingerprintHashForPlatformAsync({ cwd, platform, }) {
|
||||
try {
|
||||
const extraDebugArgs = (0, core_1.isDebug)() ? ['--build-logger-level', 'debug'] : [];
|
||||
const extraAutoSubmitArgs = autoSubmit ? ['--auto-submit'] : [];
|
||||
const { stdout } = await (0, exec_1.getExecOutput)(await (0, io_1.which)('eas', true), [
|
||||
'build',
|
||||
'--profile',
|
||||
profile,
|
||||
'--platform',
|
||||
platform,
|
||||
'--non-interactive',
|
||||
'--json',
|
||||
'--no-wait',
|
||||
...extraDebugArgs,
|
||||
...extraAutoSubmitArgs,
|
||||
], {
|
||||
const extraArgs = (0, core_1.isDebug)() ? ['--debug'] : [];
|
||||
const { stdout } = await (0, exec_1.getExecOutput)('npx', ['expo-updates', 'fingerprint:generate', '--platform', platform, ...extraArgs], {
|
||||
cwd,
|
||||
silent: !(0, core_1.isDebug)(),
|
||||
});
|
||||
return JSON.parse(stdout)[0];
|
||||
const { hash } = JSON.parse(stdout);
|
||||
if (!hash || typeof hash !== 'string') {
|
||||
throw new Error(`Invalid fingerprint output: ${stdout}`);
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Error running eas build command: ${String(error)}`, { cause: error });
|
||||
throw new Error(`Could not get fingerprint for project: ${String(error)}`);
|
||||
}
|
||||
}
|
||||
async function publishEASUpdatesAsync({ cwd, branch, environment, platform, }) {
|
||||
async function getBuildInfoWithFingerprintAsync({ cwd, platform, profile, fingerprintHash, excludeExpiredBuilds, }) {
|
||||
let stdout;
|
||||
try {
|
||||
const args = [
|
||||
'update',
|
||||
'--auto',
|
||||
'--branch',
|
||||
branch,
|
||||
const execOutput = await (0, exec_1.getExecOutput)(await (0, io_1.which)('eas', true), [
|
||||
'build:list',
|
||||
'--platform',
|
||||
platform,
|
||||
'--non-interactive',
|
||||
'--status',
|
||||
'finished',
|
||||
'--buildProfile',
|
||||
profile,
|
||||
'--runtimeVersion',
|
||||
fingerprintHash,
|
||||
'--limit',
|
||||
'1',
|
||||
'--json',
|
||||
];
|
||||
if (environment) {
|
||||
args.push('--environment', environment);
|
||||
}
|
||||
const execOutput = await (0, exec_1.getExecOutput)(await (0, io_1.which)('eas', true), args, {
|
||||
'--non-interactive',
|
||||
], {
|
||||
cwd,
|
||||
silent: !(0, core_1.isDebug)(),
|
||||
});
|
||||
stdout = execOutput.stdout;
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Error running eas update command: ${String(error)}`, { cause: error });
|
||||
throw new Error(`Could not list project builds: ${String(error)}`);
|
||||
}
|
||||
const builds = JSON.parse(stdout);
|
||||
if (!builds || !Array.isArray(builds)) {
|
||||
throw new Error(`Could not get EAS builds for project`);
|
||||
}
|
||||
if (!builds[0]) {
|
||||
return null;
|
||||
}
|
||||
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;
|
||||
try {
|
||||
const extraArgs = (0, core_1.isDebug)() ? ['--build-logger-level', 'debug'] : [];
|
||||
const execOutput = await (0, exec_1.getExecOutput)(await (0, io_1.which)('eas', true), ['build', '--profile', profile, '--platform', platform, '--non-interactive', '--json', '--no-wait', ...extraArgs], {
|
||||
cwd,
|
||||
silent: !(0, core_1.isDebug)(),
|
||||
});
|
||||
stdout = execOutput.stdout;
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Could not run command eas build: ${String(error)}`);
|
||||
}
|
||||
return JSON.parse(stdout)[0];
|
||||
}
|
||||
async function publishEASUpdatesAsync({ cwd, branch }) {
|
||||
let stdout;
|
||||
try {
|
||||
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)}`);
|
||||
}
|
||||
return JSON.parse(stdout);
|
||||
}
|
||||
function createSummaryForUpdatesAndBuilds({ config, projectId, updates, buildRunInfos, options, }) {
|
||||
function createSummaryForUpdatesAndBuilds({ config, projectId, updates, builds, options, }) {
|
||||
const appSlug = config.slug;
|
||||
const qrTarget = (0, comment_1.getQrTarget)(options);
|
||||
const appSchemes = (0, comment_1.getSchemesInOrderFromConfig)(config) || [];
|
||||
const { androidBuildRunInfo, iosBuildRunInfo } = buildRunInfos;
|
||||
const androidBuild = builds.find(build => build.platform === expo_1.AppPlatform.Android);
|
||||
const iosBuild = builds.find(build => build.platform === expo_1.AppPlatform.Ios);
|
||||
const androidUpdate = updates.find(update => update.platform === 'android');
|
||||
const iosUpdate = updates.find(update => update.platform === 'ios');
|
||||
const getBuildLink = (build) => build ? `[Build Permalink](${(0, expo_1.getBuildLogsUrl)(build)})` : 'n/a';
|
||||
const getUpdateLink = (update) => update
|
||||
? `[Update Permalink](${(0, eas_1.getUpdateGroupWebsite)({ projectId, updateGroupId: update.group })})`
|
||||
: 'n/a';
|
||||
const getUpdateLink = (update) => update ? `[Update Permalink](${(0, eas_1.getUpdateGroupWebsite)({ projectId, updateGroupId: update.group })})` : 'n/a';
|
||||
const getUpdateQRURL = (update) => update ? (0, eas_1.getUpdateGroupQr)({ projectId, updateGroupId: update.group, appSlug, qrTarget }) : null;
|
||||
const getBuildDetails = (buildRunInfo) => getBuildLink(buildRunInfo.buildInfo) +
|
||||
'<br />' +
|
||||
(0, comment_1.createDetails)({
|
||||
summary: 'Details',
|
||||
details: [
|
||||
`Distribution: \`${buildRunInfo.buildInfo.distribution}\``,
|
||||
`Build profile: \`${buildRunInfo.buildInfo.buildProfile}\``,
|
||||
`Runtime version: \`${buildRunInfo.buildInfo.runtimeVersion}\``,
|
||||
`App version: \`${buildRunInfo.buildInfo.appVersion}\``,
|
||||
`Git commit: \`${buildRunInfo.buildInfo.gitCommitHash}\``,
|
||||
].join('<br />'),
|
||||
delim: '',
|
||||
});
|
||||
const getBuildDetails = (build) => build
|
||||
? getBuildLink(build) +
|
||||
'<br />' +
|
||||
(0, comment_1.createDetails)({
|
||||
summary: 'Details',
|
||||
details: [
|
||||
`Distribution: \`${build.distribution}\``,
|
||||
`Build profile: \`${build.buildProfile}\``,
|
||||
`Runtime version: \`${build.runtimeVersion}\``,
|
||||
`App version: \`${build.appVersion}\``,
|
||||
`Git commit: \`${build.gitCommitHash}\``,
|
||||
].join('<br />'),
|
||||
delim: '',
|
||||
})
|
||||
: 'n/a';
|
||||
const getUpdateDetails = (update) => update
|
||||
? getUpdateLink(update) +
|
||||
'<br />' +
|
||||
@@ -44904,9 +44742,7 @@ function createSummaryForUpdatesAndBuilds({ config, projectId, updates, buildRun
|
||||
const androidQr = androidQRURL
|
||||
? `<a href="${androidQRURL}"><img src="${androidQRURL}" width="250px" height="250px" /></a>`
|
||||
: null;
|
||||
const iosQr = iosQRURL
|
||||
? `<a href="${iosQRURL}"><img src="${iosQRURL}" width="250px" height="250px" /></a>`
|
||||
: null;
|
||||
const iosQr = iosQRURL ? `<a href="${iosQRURL}"><img src="${iosQRURL}" width="250px" height="250px" /></a>` : null;
|
||||
const platformName = `Platform${updates.length === 1 ? '' : 's'}`;
|
||||
const platformValue = updates
|
||||
.map(update => update.platform)
|
||||
@@ -44922,8 +44758,8 @@ ${schemesMessage}
|
||||
|
||||
| ${expo_1.appPlatformEmojis[expo_1.AppPlatform.Android]} Android | ${expo_1.appPlatformEmojis[expo_1.AppPlatform.Ios]} iOS
|
||||
--- | --- | ---
|
||||
Fingerprint | ${androidBuildRunInfo?.buildInfo.runtimeVersion ?? 'n/a'} | ${iosBuildRunInfo?.buildInfo.runtimeVersion ?? 'n/a'}
|
||||
Build Details | ${androidBuildRunInfo ? getBuildDetails(androidBuildRunInfo) : 'n/a'} | ${iosBuildRunInfo ? getBuildDetails(iosBuildRunInfo) : 'n/a'}
|
||||
Fingerprint | ${androidBuild?.runtimeVersion ?? 'n/a'} | ${iosBuild?.runtimeVersion ?? 'n/a'}
|
||||
Build Details | ${getBuildDetails(androidBuild)} | ${getBuildDetails(iosBuild)}
|
||||
Update Details | ${getUpdateDetails(androidUpdate)} | ${getUpdateDetails(iosUpdate)}
|
||||
Update QR | ${androidQr ?? 'n/a'} | ${iosQr ?? 'n/a'}
|
||||
`;
|
||||
|
||||
Generated
+3
-8
@@ -89164,17 +89164,14 @@ function collectFingerprintActionInput() {
|
||||
githubToken: (0, core_1.getInput)('github-token'),
|
||||
workingDirectory: (0, core_1.getInput)('working-directory'),
|
||||
fingerprintVersion: (0, core_1.getInput)('fingerprint-version') || 'latest',
|
||||
fingerprintInstallationCache: !(0, core_1.getInput)('fingerprint-installation-cache') ||
|
||||
(0, core_1.getBooleanInput)('fingerprint-installation-cache'),
|
||||
fingerprintInstallationCache: !(0, core_1.getInput)('fingerprint-installation-cache') || (0, core_1.getBooleanInput)('fingerprint-installation-cache'),
|
||||
fingerprintDbCacheKey: (0, core_1.getInput)('fingerprint-db-cache-key'),
|
||||
previousGitCommitHash: (0, core_1.getInput)('previous-git-commit') ||
|
||||
(github_1.context.eventName === 'pull_request'
|
||||
? github_1.context.payload.pull_request?.base?.sha
|
||||
: github_1.context.payload.before),
|
||||
currentGitCommitHash: (0, core_1.getInput)('current-git-commit') ||
|
||||
(github_1.context.eventName === 'pull_request'
|
||||
? github_1.context.payload.pull_request?.head?.sha
|
||||
: github_1.context.sha),
|
||||
(github_1.context.eventName === 'pull_request' ? github_1.context.payload.pull_request?.head?.sha : github_1.context.sha),
|
||||
savingDbBranch: (0, core_1.getInput)('saving-db-branch') || undefined,
|
||||
};
|
||||
}
|
||||
@@ -89422,9 +89419,7 @@ const worker_1 = __nccwpck_require__(8912);
|
||||
async function resolvePackage(name, range) {
|
||||
let stdout = '';
|
||||
try {
|
||||
({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], {
|
||||
silent: true,
|
||||
}));
|
||||
({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], { silent: true }));
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Could not resolve ${name}@${range}`, { cause: error });
|
||||
|
||||
Generated
+3
-8
@@ -89125,17 +89125,14 @@ function collectFingerprintActionInput() {
|
||||
githubToken: (0, core_1.getInput)('github-token'),
|
||||
workingDirectory: (0, core_1.getInput)('working-directory'),
|
||||
fingerprintVersion: (0, core_1.getInput)('fingerprint-version') || 'latest',
|
||||
fingerprintInstallationCache: !(0, core_1.getInput)('fingerprint-installation-cache') ||
|
||||
(0, core_1.getBooleanInput)('fingerprint-installation-cache'),
|
||||
fingerprintInstallationCache: !(0, core_1.getInput)('fingerprint-installation-cache') || (0, core_1.getBooleanInput)('fingerprint-installation-cache'),
|
||||
fingerprintDbCacheKey: (0, core_1.getInput)('fingerprint-db-cache-key'),
|
||||
previousGitCommitHash: (0, core_1.getInput)('previous-git-commit') ||
|
||||
(github_1.context.eventName === 'pull_request'
|
||||
? github_1.context.payload.pull_request?.base?.sha
|
||||
: github_1.context.payload.before),
|
||||
currentGitCommitHash: (0, core_1.getInput)('current-git-commit') ||
|
||||
(github_1.context.eventName === 'pull_request'
|
||||
? github_1.context.payload.pull_request?.head?.sha
|
||||
: github_1.context.sha),
|
||||
(github_1.context.eventName === 'pull_request' ? github_1.context.payload.pull_request?.head?.sha : github_1.context.sha),
|
||||
savingDbBranch: (0, core_1.getInput)('saving-db-branch') || undefined,
|
||||
};
|
||||
}
|
||||
@@ -89383,9 +89380,7 @@ const worker_1 = __nccwpck_require__(8912);
|
||||
async function resolvePackage(name, range) {
|
||||
let stdout = '';
|
||||
try {
|
||||
({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], {
|
||||
silent: true,
|
||||
}));
|
||||
({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], { silent: true }));
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Could not resolve ${name}@${range}`, { cause: error });
|
||||
|
||||
Generated
+15
-42
@@ -88827,7 +88827,7 @@ function collectPreviewBuildActionInput() {
|
||||
exports.collectPreviewBuildActionInput = collectPreviewBuildActionInput;
|
||||
(0, worker_1.executeAction)(previewAction);
|
||||
async function previewAction(input = collectPreviewBuildActionInput()) {
|
||||
const config = await (0, project_1.loadProjectConfig)(input.workingDirectory, null);
|
||||
const config = await (0, project_1.loadProjectConfig)(input.workingDirectory);
|
||||
if (!config.extra?.eas?.projectId) {
|
||||
return (0, core_1.setFailed)('Missing "extra.eas.projectId" in app.json or app.config.js. Please run `eas build:configure` first.');
|
||||
}
|
||||
@@ -89299,7 +89299,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectAppType = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.BuildStatus = exports.AppPlatform = void 0;
|
||||
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectAppType = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.AppPlatform = void 0;
|
||||
const core_1 = __nccwpck_require__(2186);
|
||||
const exec_1 = __nccwpck_require__(1514);
|
||||
const io_1 = __nccwpck_require__(7436);
|
||||
@@ -89311,16 +89311,6 @@ var AppPlatform;
|
||||
AppPlatform["Android"] = "ANDROID";
|
||||
AppPlatform["Ios"] = "IOS";
|
||||
})(AppPlatform || (exports.AppPlatform = AppPlatform = {}));
|
||||
var BuildStatus;
|
||||
(function (BuildStatus) {
|
||||
BuildStatus["New"] = "NEW";
|
||||
BuildStatus["InQueue"] = "IN_QUEUE";
|
||||
BuildStatus["InProgress"] = "IN_PROGRESS";
|
||||
BuildStatus["PendingCancel"] = "PENDING_CANCEL";
|
||||
BuildStatus["Errored"] = "ERRORED";
|
||||
BuildStatus["Finished"] = "FINISHED";
|
||||
BuildStatus["Canceled"] = "CANCELED";
|
||||
})(BuildStatus || (exports.BuildStatus = BuildStatus = {}));
|
||||
exports.appPlatformDisplayNames = {
|
||||
[AppPlatform.Android]: 'Android',
|
||||
[AppPlatform.Ios]: 'iOS',
|
||||
@@ -89498,8 +89488,7 @@ function projectAppType(dir) {
|
||||
catch (error) {
|
||||
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
|
||||
}
|
||||
if (packageJson?.dependencies?.['expo-dev-client'] ||
|
||||
packageJson?.devDependencies?.['expo-dev-client']) {
|
||||
if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
|
||||
return 'dev-build';
|
||||
}
|
||||
return 'expo-go';
|
||||
@@ -89544,10 +89533,13 @@ function projectDeepLink(project, channel) {
|
||||
}
|
||||
exports.projectDeepLink = projectDeepLink;
|
||||
function getBuildLogsUrl(build) {
|
||||
// TODO: reuse this function from the original source
|
||||
// see: https://github.com/expo/eas-cli/blob/896f7f038582347c57dc700be9ea7d092b5a3a21/packages/eas-cli/src/build/utils/url.ts#L13-L21
|
||||
const { project } = build;
|
||||
const path = `/accounts/${project.ownerAccount.name}/projects/${project.slug}/builds/${build.id}`;
|
||||
const baseUrl = process.env.EXPO_STAGING ? 'staging.expo.dev' : 'expo.dev';
|
||||
const url = new url_1.URL(path, `https://${baseUrl}`);
|
||||
const path = project
|
||||
? `/accounts/${project.ownerAccount.name}/projects/${project.slug}/builds/${build.id}`
|
||||
: `/builds/${build.id}`;
|
||||
const url = new url_1.URL(path, 'https://expo.dev');
|
||||
return url.toString();
|
||||
}
|
||||
exports.getBuildLogsUrl = getBuildLogsUrl;
|
||||
@@ -89769,17 +89761,14 @@ function collectFingerprintActionInput() {
|
||||
githubToken: (0, core_1.getInput)('github-token'),
|
||||
workingDirectory: (0, core_1.getInput)('working-directory'),
|
||||
fingerprintVersion: (0, core_1.getInput)('fingerprint-version') || 'latest',
|
||||
fingerprintInstallationCache: !(0, core_1.getInput)('fingerprint-installation-cache') ||
|
||||
(0, core_1.getBooleanInput)('fingerprint-installation-cache'),
|
||||
fingerprintInstallationCache: !(0, core_1.getInput)('fingerprint-installation-cache') || (0, core_1.getBooleanInput)('fingerprint-installation-cache'),
|
||||
fingerprintDbCacheKey: (0, core_1.getInput)('fingerprint-db-cache-key'),
|
||||
previousGitCommitHash: (0, core_1.getInput)('previous-git-commit') ||
|
||||
(github_1.context.eventName === 'pull_request'
|
||||
? github_1.context.payload.pull_request?.base?.sha
|
||||
: github_1.context.payload.before),
|
||||
currentGitCommitHash: (0, core_1.getInput)('current-git-commit') ||
|
||||
(github_1.context.eventName === 'pull_request'
|
||||
? github_1.context.payload.pull_request?.head?.sha
|
||||
: github_1.context.sha),
|
||||
(github_1.context.eventName === 'pull_request' ? github_1.context.payload.pull_request?.head?.sha : github_1.context.sha),
|
||||
savingDbBranch: (0, core_1.getInput)('saving-db-branch') || undefined,
|
||||
};
|
||||
}
|
||||
@@ -90027,9 +90016,7 @@ const worker_1 = __nccwpck_require__(8912);
|
||||
async function resolvePackage(name, range) {
|
||||
let stdout = '';
|
||||
try {
|
||||
({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], {
|
||||
silent: true,
|
||||
}));
|
||||
({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], { silent: true }));
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Could not resolve ${name}@${range}`, { cause: error });
|
||||
@@ -90069,32 +90056,18 @@ exports.installPackage = installPackage;
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.loadProjectConfig = void 0;
|
||||
const core_1 = __nccwpck_require__(2186);
|
||||
const exec_1 = __nccwpck_require__(1514);
|
||||
const io_1 = __nccwpck_require__(7436);
|
||||
/**
|
||||
* Load the Expo app project config in the given directory.
|
||||
* This runs `expo config` command instead of using `@expo/config` directly,
|
||||
* to use the app's own version of the config.
|
||||
*/
|
||||
async function loadProjectConfig(cwd, easEnvironment) {
|
||||
async function loadProjectConfig(cwd) {
|
||||
let stdout = '';
|
||||
const baseArguments = ['expo', 'config', '--json', '--type', 'public'];
|
||||
let commandLine;
|
||||
let args;
|
||||
if (easEnvironment) {
|
||||
commandLine = await (0, io_1.which)('eas', true);
|
||||
const commandToExecute = ['npx', ...baseArguments].join(' ').replace(/"/g, '\\"');
|
||||
args = ['env:exec', '--non-interactive', easEnvironment, `"${commandToExecute}"`];
|
||||
}
|
||||
else {
|
||||
commandLine = 'npx';
|
||||
args = baseArguments;
|
||||
}
|
||||
try {
|
||||
({ stdout } = await (0, exec_1.getExecOutput)(commandLine, args, {
|
||||
({ stdout } = await (0, exec_1.getExecOutput)('npx', ['expo', 'config', '--json', '--type', 'public'], {
|
||||
cwd,
|
||||
silent: !(0, core_1.isDebug)(),
|
||||
silent: true,
|
||||
}));
|
||||
}
|
||||
catch (error) {
|
||||
|
||||
Generated
+8
-16
@@ -38643,7 +38643,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectAppType = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.BuildStatus = exports.AppPlatform = void 0;
|
||||
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectAppType = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.AppPlatform = void 0;
|
||||
const core_1 = __nccwpck_require__(2186);
|
||||
const exec_1 = __nccwpck_require__(1514);
|
||||
const io_1 = __nccwpck_require__(7436);
|
||||
@@ -38655,16 +38655,6 @@ var AppPlatform;
|
||||
AppPlatform["Android"] = "ANDROID";
|
||||
AppPlatform["Ios"] = "IOS";
|
||||
})(AppPlatform || (exports.AppPlatform = AppPlatform = {}));
|
||||
var BuildStatus;
|
||||
(function (BuildStatus) {
|
||||
BuildStatus["New"] = "NEW";
|
||||
BuildStatus["InQueue"] = "IN_QUEUE";
|
||||
BuildStatus["InProgress"] = "IN_PROGRESS";
|
||||
BuildStatus["PendingCancel"] = "PENDING_CANCEL";
|
||||
BuildStatus["Errored"] = "ERRORED";
|
||||
BuildStatus["Finished"] = "FINISHED";
|
||||
BuildStatus["Canceled"] = "CANCELED";
|
||||
})(BuildStatus || (exports.BuildStatus = BuildStatus = {}));
|
||||
exports.appPlatformDisplayNames = {
|
||||
[AppPlatform.Android]: 'Android',
|
||||
[AppPlatform.Ios]: 'iOS',
|
||||
@@ -38842,8 +38832,7 @@ function projectAppType(dir) {
|
||||
catch (error) {
|
||||
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
|
||||
}
|
||||
if (packageJson?.dependencies?.['expo-dev-client'] ||
|
||||
packageJson?.devDependencies?.['expo-dev-client']) {
|
||||
if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
|
||||
return 'dev-build';
|
||||
}
|
||||
return 'expo-go';
|
||||
@@ -38888,10 +38877,13 @@ function projectDeepLink(project, channel) {
|
||||
}
|
||||
exports.projectDeepLink = projectDeepLink;
|
||||
function getBuildLogsUrl(build) {
|
||||
// TODO: reuse this function from the original source
|
||||
// see: https://github.com/expo/eas-cli/blob/896f7f038582347c57dc700be9ea7d092b5a3a21/packages/eas-cli/src/build/utils/url.ts#L13-L21
|
||||
const { project } = build;
|
||||
const path = `/accounts/${project.ownerAccount.name}/projects/${project.slug}/builds/${build.id}`;
|
||||
const baseUrl = process.env.EXPO_STAGING ? 'staging.expo.dev' : 'expo.dev';
|
||||
const url = new url_1.URL(path, `https://${baseUrl}`);
|
||||
const path = project
|
||||
? `/accounts/${project.ownerAccount.name}/projects/${project.slug}/builds/${build.id}`
|
||||
: `/builds/${build.id}`;
|
||||
const url = new url_1.URL(path, 'https://expo.dev');
|
||||
return url.toString();
|
||||
}
|
||||
exports.getBuildLogsUrl = getBuildLogsUrl;
|
||||
|
||||
Generated
+16
-46
@@ -41877,7 +41877,7 @@ async function previewAction(input = previewInput()) {
|
||||
if (!update) {
|
||||
return (0, core_1.setFailed)(`No update found in command output.`);
|
||||
}
|
||||
const config = await (0, project_1.loadProjectConfig)(input.workingDirectory, null);
|
||||
const config = await (0, project_1.loadProjectConfig)(input.workingDirectory);
|
||||
if (!config.extra?.eas?.projectId) {
|
||||
return (0, core_1.setFailed)(`Missing 'extra.eas.projectId' in app.json or app.config.js.`);
|
||||
}
|
||||
@@ -41961,9 +41961,7 @@ function getVariables(config, updates, options) {
|
||||
androidManifestPermalink: android?.manifestPermalink || '',
|
||||
androidMessage: android?.message || '',
|
||||
androidRuntimeVersion: android?.runtimeVersion || '',
|
||||
androidQR: android
|
||||
? (0, eas_1.getUpdateGroupQr)({ projectId, updateGroupId: android.group, appSlug, qrTarget })
|
||||
: '',
|
||||
androidQR: android ? (0, eas_1.getUpdateGroupQr)({ projectId, updateGroupId: android.group, appSlug, qrTarget }) : '',
|
||||
androidLink: android ? (0, eas_1.getUpdateGroupWebsite)({ projectId, updateGroupId: android.group }) : '',
|
||||
// iOS update
|
||||
iosId: ios?.id || '',
|
||||
@@ -41996,9 +41994,7 @@ function createSummaryHeader(updates, vars) {
|
||||
.sort((a, b) => a.localeCompare(b))
|
||||
.map(platform => `**${platform}**`)
|
||||
.join(', ');
|
||||
const appSchemes = vars.projectScheme
|
||||
? `- Scheme → **${JSON.parse(vars.projectSchemes).join('**, **')}**`
|
||||
: '';
|
||||
const appSchemes = vars.projectScheme ? `- Scheme → **${JSON.parse(vars.projectSchemes).join('**, **')}**` : '';
|
||||
return `🚀 Expo preview is ready!
|
||||
|
||||
- Project → **${vars.projectSlug}**
|
||||
@@ -42121,7 +42117,7 @@ async function assertEasVersion(versionRange) {
|
||||
throw new Error(`Could not verify the EAS CLI version, reason:\nCommand failed 'eas --version'`);
|
||||
}
|
||||
const version = stdout.match(/eas-cli\/([^\s]+)/i);
|
||||
if (!version?.[1]) {
|
||||
if (!version || !version[1]) {
|
||||
throw new Error(`Could not verify the EAS CLI version, reason:\nUnexpected output received.`);
|
||||
}
|
||||
if (!semver_1.default.satisfies(version[1], versionRange)) {
|
||||
@@ -42157,9 +42153,6 @@ function getUpdateGroupQr({ projectId, updateGroupId, appSlug, qrTarget, }) {
|
||||
// See: https://github.com/expo/expo/blob/8ae75dde393e5d2393d446227a1fe2482c75eec3/packages/expo-dev-client/plugin/src/getDefaultScheme.ts#L17
|
||||
url.searchParams.append('appScheme', appSlug.replace(/[^A-Za-z0-9+\-.]/g, ''));
|
||||
}
|
||||
if (process.env.EXPO_STAGING) {
|
||||
url.searchParams.append('host', 'staging-u.expo.dev');
|
||||
}
|
||||
url.searchParams.append('projectId', projectId);
|
||||
url.searchParams.append('groupId', updateGroupId);
|
||||
return url.toString();
|
||||
@@ -42167,8 +42160,7 @@ function getUpdateGroupQr({ projectId, updateGroupId, appSlug, qrTarget, }) {
|
||||
exports.getUpdateGroupQr = getUpdateGroupQr;
|
||||
/** Create the absolute link to the update group on expo.dev */
|
||||
function getUpdateGroupWebsite({ projectId, updateGroupId, }) {
|
||||
const baseUrl = process.env.EXPO_STAGING ? 'staging.expo.dev' : 'expo.dev';
|
||||
return `https://${baseUrl}/projects/${projectId}/updates/${updateGroupId}`;
|
||||
return `https://expo.dev/projects/${projectId}/updates/${updateGroupId}`;
|
||||
}
|
||||
exports.getUpdateGroupWebsite = getUpdateGroupWebsite;
|
||||
|
||||
@@ -42184,7 +42176,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectAppType = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.BuildStatus = exports.AppPlatform = void 0;
|
||||
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectAppType = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.AppPlatform = void 0;
|
||||
const core_1 = __nccwpck_require__(2186);
|
||||
const exec_1 = __nccwpck_require__(1514);
|
||||
const io_1 = __nccwpck_require__(7436);
|
||||
@@ -42196,16 +42188,6 @@ var AppPlatform;
|
||||
AppPlatform["Android"] = "ANDROID";
|
||||
AppPlatform["Ios"] = "IOS";
|
||||
})(AppPlatform || (exports.AppPlatform = AppPlatform = {}));
|
||||
var BuildStatus;
|
||||
(function (BuildStatus) {
|
||||
BuildStatus["New"] = "NEW";
|
||||
BuildStatus["InQueue"] = "IN_QUEUE";
|
||||
BuildStatus["InProgress"] = "IN_PROGRESS";
|
||||
BuildStatus["PendingCancel"] = "PENDING_CANCEL";
|
||||
BuildStatus["Errored"] = "ERRORED";
|
||||
BuildStatus["Finished"] = "FINISHED";
|
||||
BuildStatus["Canceled"] = "CANCELED";
|
||||
})(BuildStatus || (exports.BuildStatus = BuildStatus = {}));
|
||||
exports.appPlatformDisplayNames = {
|
||||
[AppPlatform.Android]: 'Android',
|
||||
[AppPlatform.Ios]: 'iOS',
|
||||
@@ -42383,8 +42365,7 @@ function projectAppType(dir) {
|
||||
catch (error) {
|
||||
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
|
||||
}
|
||||
if (packageJson?.dependencies?.['expo-dev-client'] ||
|
||||
packageJson?.devDependencies?.['expo-dev-client']) {
|
||||
if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
|
||||
return 'dev-build';
|
||||
}
|
||||
return 'expo-go';
|
||||
@@ -42429,10 +42410,13 @@ function projectDeepLink(project, channel) {
|
||||
}
|
||||
exports.projectDeepLink = projectDeepLink;
|
||||
function getBuildLogsUrl(build) {
|
||||
// TODO: reuse this function from the original source
|
||||
// see: https://github.com/expo/eas-cli/blob/896f7f038582347c57dc700be9ea7d092b5a3a21/packages/eas-cli/src/build/utils/url.ts#L13-L21
|
||||
const { project } = build;
|
||||
const path = `/accounts/${project.ownerAccount.name}/projects/${project.slug}/builds/${build.id}`;
|
||||
const baseUrl = process.env.EXPO_STAGING ? 'staging.expo.dev' : 'expo.dev';
|
||||
const url = new url_1.URL(path, `https://${baseUrl}`);
|
||||
const path = project
|
||||
? `/accounts/${project.ownerAccount.name}/projects/${project.slug}/builds/${build.id}`
|
||||
: `/builds/${build.id}`;
|
||||
const url = new url_1.URL(path, 'https://expo.dev');
|
||||
return url.toString();
|
||||
}
|
||||
exports.getBuildLogsUrl = getBuildLogsUrl;
|
||||
@@ -42613,32 +42597,18 @@ exports.getPullRequestFromGitCommitShaAsync = getPullRequestFromGitCommitShaAsyn
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.loadProjectConfig = void 0;
|
||||
const core_1 = __nccwpck_require__(2186);
|
||||
const exec_1 = __nccwpck_require__(1514);
|
||||
const io_1 = __nccwpck_require__(7436);
|
||||
/**
|
||||
* Load the Expo app project config in the given directory.
|
||||
* This runs `expo config` command instead of using `@expo/config` directly,
|
||||
* to use the app's own version of the config.
|
||||
*/
|
||||
async function loadProjectConfig(cwd, easEnvironment) {
|
||||
async function loadProjectConfig(cwd) {
|
||||
let stdout = '';
|
||||
const baseArguments = ['expo', 'config', '--json', '--type', 'public'];
|
||||
let commandLine;
|
||||
let args;
|
||||
if (easEnvironment) {
|
||||
commandLine = await (0, io_1.which)('eas', true);
|
||||
const commandToExecute = ['npx', ...baseArguments].join(' ').replace(/"/g, '\\"');
|
||||
args = ['env:exec', '--non-interactive', easEnvironment, `"${commandToExecute}"`];
|
||||
}
|
||||
else {
|
||||
commandLine = 'npx';
|
||||
args = baseArguments;
|
||||
}
|
||||
try {
|
||||
({ stdout } = await (0, exec_1.getExecOutput)(commandLine, args, {
|
||||
({ stdout } = await (0, exec_1.getExecOutput)('npx', ['expo', 'config', '--json', '--type', 'public'], {
|
||||
cwd,
|
||||
silent: !(0, core_1.isDebug)(),
|
||||
silent: true,
|
||||
}));
|
||||
}
|
||||
catch (error) {
|
||||
|
||||
Generated
+9
-19
@@ -88920,7 +88920,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectAppType = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.BuildStatus = exports.AppPlatform = void 0;
|
||||
exports.getBuildLogsUrl = exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectAppType = exports.projectInfo = exports.queryEasBuildInfoAsync = exports.cancelEasBuildAsync = exports.createEasBuildFromRawCommandAsync = exports.easBuild = exports.runCommand = exports.projectOwner = exports.authenticate = exports.parseCommand = exports.appPlatformEmojis = exports.appPlatformDisplayNames = exports.AppPlatform = void 0;
|
||||
const core_1 = __nccwpck_require__(2186);
|
||||
const exec_1 = __nccwpck_require__(1514);
|
||||
const io_1 = __nccwpck_require__(7436);
|
||||
@@ -88932,16 +88932,6 @@ var AppPlatform;
|
||||
AppPlatform["Android"] = "ANDROID";
|
||||
AppPlatform["Ios"] = "IOS";
|
||||
})(AppPlatform || (exports.AppPlatform = AppPlatform = {}));
|
||||
var BuildStatus;
|
||||
(function (BuildStatus) {
|
||||
BuildStatus["New"] = "NEW";
|
||||
BuildStatus["InQueue"] = "IN_QUEUE";
|
||||
BuildStatus["InProgress"] = "IN_PROGRESS";
|
||||
BuildStatus["PendingCancel"] = "PENDING_CANCEL";
|
||||
BuildStatus["Errored"] = "ERRORED";
|
||||
BuildStatus["Finished"] = "FINISHED";
|
||||
BuildStatus["Canceled"] = "CANCELED";
|
||||
})(BuildStatus || (exports.BuildStatus = BuildStatus = {}));
|
||||
exports.appPlatformDisplayNames = {
|
||||
[AppPlatform.Android]: 'Android',
|
||||
[AppPlatform.Ios]: 'iOS',
|
||||
@@ -89119,8 +89109,7 @@ function projectAppType(dir) {
|
||||
catch (error) {
|
||||
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
|
||||
}
|
||||
if (packageJson?.dependencies?.['expo-dev-client'] ||
|
||||
packageJson?.devDependencies?.['expo-dev-client']) {
|
||||
if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
|
||||
return 'dev-build';
|
||||
}
|
||||
return 'expo-go';
|
||||
@@ -89165,10 +89154,13 @@ function projectDeepLink(project, channel) {
|
||||
}
|
||||
exports.projectDeepLink = projectDeepLink;
|
||||
function getBuildLogsUrl(build) {
|
||||
// TODO: reuse this function from the original source
|
||||
// see: https://github.com/expo/eas-cli/blob/896f7f038582347c57dc700be9ea7d092b5a3a21/packages/eas-cli/src/build/utils/url.ts#L13-L21
|
||||
const { project } = build;
|
||||
const path = `/accounts/${project.ownerAccount.name}/projects/${project.slug}/builds/${build.id}`;
|
||||
const baseUrl = process.env.EXPO_STAGING ? 'staging.expo.dev' : 'expo.dev';
|
||||
const url = new url_1.URL(path, `https://${baseUrl}`);
|
||||
const path = project
|
||||
? `/accounts/${project.ownerAccount.name}/projects/${project.slug}/builds/${build.id}`
|
||||
: `/builds/${build.id}`;
|
||||
const url = new url_1.URL(path, 'https://expo.dev');
|
||||
return url.toString();
|
||||
}
|
||||
exports.getBuildLogsUrl = getBuildLogsUrl;
|
||||
@@ -89360,9 +89352,7 @@ const worker_1 = __nccwpck_require__(8912);
|
||||
async function resolvePackage(name, range) {
|
||||
let stdout = '';
|
||||
try {
|
||||
({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], {
|
||||
silent: true,
|
||||
}));
|
||||
({ stdout } = await (0, exec_1.getExecOutput)('npm', ['info', `${name}@${range}`, 'version', '--json'], { silent: true }));
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Could not resolve ${name}@${range}`, { cause: error });
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
<div align="center">
|
||||
<h1>continuous-deploy-fingerprint-info</h1>
|
||||
<p>Fetch and output fingerprints and matching builds for use in continuous deployment workflows.</p>
|
||||
</div>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/expo/expo-github-action/releases" title="Latest release">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/github/package-json/v/expo/expo-github-action?style=flat-square&color=0366D6&labelColor=49505A">
|
||||
<img alt="Latest release" src="https://img.shields.io/github/package-json/v/expo/expo-github-action?style=flat-square&color=0366D6&labelColor=D1D5DA" />
|
||||
</picture>
|
||||
</a>
|
||||
<a href="https://github.com/expo/expo-github-action/actions" title="Workflow status">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/github/actions/workflow/status/expo/expo-github-action/test.yml?branch=main&style=flat-square&labelColor=49505A">
|
||||
<img alt="Workflow status" src="https://img.shields.io/github/actions/workflow/status/expo/expo-github-action/test.yml?branch=main&style=flat-square&labelColor=D1D5DA" />
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#usage"><b>Usage</b></a>
|
||||
—
|
||||
<a href="#available-outputs"><b>Outputs</b></a>
|
||||
—
|
||||
<a href="#example-workflows"><b>Examples</b></a>
|
||||
—
|
||||
<a href="#caveats"><b>Caveats</b></a>
|
||||
—
|
||||
<a href="https://github.com/expo/expo-github-action/blob/main/CHANGELOG.md"><b>Changelog</b></a>
|
||||
</p>
|
||||
|
||||
<br />
|
||||
|
||||
> **Warning**
|
||||
> This sub action is still in development and might change without notice. It is not yet ready for use.
|
||||
|
||||
## Overview
|
||||
|
||||
`continuous-deploy-fingerprint-info` is a GitHub Action that fetches fingerprints and matching builds for use in continuous deployment workflows.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Must have expo-updates set up with a `fingerprint` runtime version policy.
|
||||
- Must be configured for EAS Update.
|
||||
|
||||
### Configuration options
|
||||
|
||||
This action is customizable through variables defined in the [`action.yml`](action.yml).
|
||||
Here is a summary of all the input options you can use.
|
||||
|
||||
| variable | default | description |
|
||||
| --------------------- | -------------- | ---------------------------------------------------------------------------- |
|
||||
| **profile** | (required) | The EAS Build profile to use |
|
||||
| **environment** | - | The environment to use for server-side defined EAS environment variables |
|
||||
| **working-directory** | - | The relative directory of your Expo app |
|
||||
| **platform** | `all` | The platform to use (available options are `ios`, `android` and `all`) |
|
||||
| **github-token** | `github.token` | GitHub token to use when pushing version bump commit ([read more](#github-tokens)) |
|
||||
|
||||
And the action will generate these [outputs](#available-outputs) for other actions to do something based on what this action did.
|
||||
|
||||
### Available outputs
|
||||
|
||||
In case you want to reuse this action for other purpose, this action will set the following action outputs.
|
||||
|
||||
| output name | description |
|
||||
| ------------------------ | ------------------------------ |
|
||||
| **ios-fingerprint** | The iOS fingerprint of the current commit. |
|
||||
| **android-fingerprint** | The Android fingerprint of the current commit. |
|
||||
| **android-build-id** | ID for matching Android EAS Build if one exists for fingerprint. |
|
||||
| **ios-build-id** | ID for matching iOS EAS Build if one exists for fingerprint. |
|
||||
|
||||
## Caveats
|
||||
|
||||
### GitHub tokens
|
||||
|
||||
When using the GitHub API, you always need to be authenticated.
|
||||
This action tries to auto-authenticate using the [Automatic token authentication][link-gha-token] from GitHub.
|
||||
You can overwrite the token by adding the `GITHUB_TOKEN` environment variable or add the **github-token** input.
|
||||
|
||||
## Example workflows
|
||||
|
||||
Before diving into the workflow examples, you should know the basics of GitHub Actions.
|
||||
You can read more about this in the [GitHub Actions documentation][link-actions].
|
||||
|
||||
See documentation for the `continuous-deploy-fingerprint` for how one may use this action.
|
||||
|
||||
<div align="center">
|
||||
<br />
|
||||
with :heart: <strong>Expo</strong>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
[link-actions]: https://help.github.com/en/categories/automating-your-workflow-with-github-actions
|
||||
[link-gha-token]: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
|
||||
@@ -1,39 +0,0 @@
|
||||
---
|
||||
name: Expo GitHub Action - Get Fingerprint Info and Matching Builds for Continuous Deployment use cases
|
||||
author: Expo
|
||||
description: Get the current fingeprint and any matching builds. Designed to be used in tandem with continuous-deploy-fingerprint for continuous deployment.
|
||||
branding:
|
||||
icon: smartphone
|
||||
color: gray-dark
|
||||
runs:
|
||||
using: node20
|
||||
main: ../build/continuous-deploy-fingerprint-info/index.js
|
||||
inputs:
|
||||
profile:
|
||||
description: The EAS Build profile to use, must have EAS Update channel specified in eas.json
|
||||
required: true
|
||||
platform:
|
||||
description: The platform on which to publish. Possible values are 'all' | 'android' | 'ios'
|
||||
required: false
|
||||
default: all
|
||||
environment:
|
||||
description: The environment to use for server-side defined EAS environment variables during command execution
|
||||
required: false
|
||||
github-token:
|
||||
description: GitHub token to use when commenting on PR
|
||||
required: false
|
||||
default: ${{ github.token }}
|
||||
working-directory:
|
||||
description: The relative directory of your Expo app
|
||||
required: false
|
||||
default: ${{ github.workspace }}
|
||||
|
||||
outputs:
|
||||
android-fingerprint:
|
||||
description: The Android fingerprint of the current commit.
|
||||
ios-fingerprint:
|
||||
description: The iOS fingerprint of the current commit.
|
||||
android-build-id:
|
||||
description: ID for Android EAS Build with matching fingerprint.
|
||||
ios-build-id:
|
||||
description: ID for iOS EAS Build with matching fingerprint.
|
||||
@@ -1,6 +1,6 @@
|
||||
<div align="center">
|
||||
<h1>continuous-deploy-fingerprint</h1>
|
||||
<p>Continuously deploys an Expo project using EAS Build and EAS Update in combination with a fingerprint runtime version</p>
|
||||
<p>Continuously deploys an Expo project using EAS Build and EAS Update in combination with fingerprint runtime versions</p>
|
||||
</div>
|
||||
|
||||
<p align="center">
|
||||
@@ -37,34 +37,24 @@
|
||||
|
||||
## Overview
|
||||
|
||||
`continuous-deploy-fingerprint` is a GitHub Action that continuously deploys an Expo project using the expo-updates fingerprint runtime version policy. When run, it performs the following tasks in order, once for each platform:
|
||||
`continuous-deploy-fingerprint` is a GitHub Action continuously deploys an Expo project using the expo-updates fingerprint runtime version policy. When run, it performs the following tasks in order, once for each platform:
|
||||
1. Check current fingerprint of the project.
|
||||
2. Check for EAS builds with specified profile matching that fingerprint.
|
||||
3. If a in-progress or finished EAS build doesn't exist, start one.
|
||||
3. If an EAS build doesn't exist, start one.
|
||||
4. Publish an update on EAS update.
|
||||
5. If run on a PR, post a comment indicating what was done.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Must have expo-updates set up with a `fingerprint` runtime version policy.
|
||||
- Must be configured for EAS Update.
|
||||
- Must have run the builds at least once manually in order to configure credentials. This can be done by running `eas build --profile <profile> --platform <platform>` for each profile and platform you have set up for this action.
|
||||
- When using `auto-submit-builds`, must have configured [EAS Submit](https://docs.expo.dev/submit/introduction/) and run submissions manually at least once.
|
||||
|
||||
### Configuration options
|
||||
|
||||
This action is customizable through variables defined in the [`action.yml`](action.yml).
|
||||
Here is a summary of all the input options you can use.
|
||||
|
||||
| variable | default | description |
|
||||
| ----------------------- | -------------- | ---------------------------------------------------------------------------- |
|
||||
| **profile** | (required) | The EAS Build profile to use |
|
||||
| **branch** | (required) | The EAS Update branch on which to publish |
|
||||
| **environment** | - | The environment to use for server-side defined EAS environment variables |
|
||||
| **working-directory** | - | The relative directory of your Expo app |
|
||||
| **platform** | `all` | The platform to deploy on (available options are `ios`, `android` and `all`) |
|
||||
| **auto-submit-builds**| - | Whether to add the `--auto-submit` flag to the issued `eas build` commands. |
|
||||
| **github-token** | `github.token` | GitHub token to use when commenting on PR ([read more](#github-tokens)) |
|
||||
| variable | default | description |
|
||||
| ---------------------------------- | ---------------- | ----------------------------------------------------------------------- |
|
||||
| **profile** | (required) | The EAS Build profile to use |
|
||||
| **branch** | (required) | The EAS Update branch on which to publish |
|
||||
| **working-directory** | - | The relative directory of your Expo app |
|
||||
| **github-token** | `github.token` | GitHub token to use when commenting on PR ([read more](#github-tokens)) |
|
||||
|
||||
And the action will generate these [outputs](#available-outputs) for other actions to do something based on what this action did.
|
||||
|
||||
@@ -72,13 +62,13 @@ And the action will generate these [outputs](#available-outputs) for other actio
|
||||
|
||||
In case you want to reuse this action for other purpose, this action will set the following action outputs.
|
||||
|
||||
| output name | description |
|
||||
| ----------------------- | ------------------------------------------------ |
|
||||
| **ios-fingerprint** | The iOS fingerprint of the current commit. |
|
||||
| **android-fingerprint** | The Android fingerprint of the current commit. |
|
||||
| **android-build-id** | ID for Android EAS Build if one was started. |
|
||||
| **ios-build-id** | ID for iOS EAS Build if one was started. |
|
||||
| **update-output** | The output (JSON) from the `eas update` command. |
|
||||
| output name | description |
|
||||
| ------------------------ | ------------------------------ |
|
||||
| **ios-fingerprint** | The iOS fingerprint of the current commit. |
|
||||
| **android-fingerprint** | The Android fingerprint of the current commit. |
|
||||
| **android-build-id** | ID for Android EAS Build if one was started. |
|
||||
| **ios-build-id** | ID for iOS EAS Build if one was started. |
|
||||
| **update-output** | The output (JSON) from the `eas update` command. |
|
||||
|
||||
## Caveats
|
||||
|
||||
@@ -88,23 +78,37 @@ When using the GitHub API, you always need to be authenticated.
|
||||
This action tries to auto-authenticate using the [Automatic token authentication][link-gha-token] from GitHub.
|
||||
You can overwrite the token by adding the `GITHUB_TOKEN` environment variable or add the **github-token** input.
|
||||
|
||||
<div align="center">
|
||||
<br />
|
||||
with :heart: <strong>Expo</strong>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
## Example workflows
|
||||
|
||||
Before diving into the workflow examples, you should know the basics of GitHub Actions.
|
||||
You can read more about this in the [GitHub Actions documentation][link-actions].
|
||||
|
||||
### Continuous development on pull requests (recommended)
|
||||
### Continuously deploy after tests on main branch and pull requests
|
||||
|
||||
This example workflow continuously deploys PR branches to the development EAS Build profile and EAS Update branch. It will do a development build if necessary and display a QR code to scan to preview the latest commit on the PR.
|
||||
This workflow continuously deploys:
|
||||
- main branch -> production EAS Build profile and EAS Update branch
|
||||
- PR branches -> development EAS Build profile and EAS Update branch
|
||||
|
||||
This means that every commit landed to main will go out to users on production. If a new build is created, it will need to be manually submitted to the app stores.
|
||||
|
||||
Pull requests also do a build if necessary and display a QR code to scan to preview the latest commit on the PR.
|
||||
|
||||
```yml
|
||||
name: Continuous Development (PRs)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
|
||||
env:
|
||||
EXPO_STAGING: 1
|
||||
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
|
||||
|
||||
jobs:
|
||||
@@ -126,7 +130,7 @@ jobs:
|
||||
continuously-deploy:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
concurrency: continuous-deploy-fingerprint-${{ github.run_id }}
|
||||
concurrency: continuous-deploy-fingerprint-${{ github.event_name != 'pull_request' && 'main' || github.run_id }}
|
||||
permissions:
|
||||
contents: read # Allow checkout
|
||||
pull-requests: write # Allow comments on PRs
|
||||
@@ -151,117 +155,6 @@ jobs:
|
||||
- name: Continuously Deploy
|
||||
uses: expo/expo-github-action/continuous-deploy-fingerprint@main
|
||||
with:
|
||||
profile: development
|
||||
branch: development
|
||||
profile: ${{ github.event_name != 'pull_request' && 'production' || 'development' }}
|
||||
branch: ${{ github.event_name != 'pull_request' && 'production' || 'development' }}
|
||||
```
|
||||
|
||||
### Continuous deployment on main (advanced)
|
||||
|
||||
This example workflow continuously deploys the main branch to the production EAS Build profile and EAS Update branch. It also does automatic version bumping and auto-submission using EAS Submit when applicable. Note that this still will require human intervention on the app store side in order to promote the submitted build to production.
|
||||
|
||||
> **Warning**
|
||||
> It's unlikely that this is a one-size-fits-all workflow as project-specific pattens will require different strategies depending on your project's CNG, version bumping, and submission preferences. This example is only intended to demonstrate the broad strategy. It should also be noted that while this theoretically should work, it's unlikely that auto-submission on
|
||||
every new fingeprint is desired as it could cause too many app store submissions.
|
||||
|
||||
```yml
|
||||
name: Continuous Deployment (main)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v4
|
||||
- name: 🏗 Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: yarn
|
||||
- name: 📦 Install dependencies
|
||||
run: yarn install
|
||||
- name: 🧪 Run tests
|
||||
run: yarn test
|
||||
|
||||
continuously-deploy:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
concurrency: continuous-deploy-fingerprint-main
|
||||
permissions:
|
||||
contents: write # Allow checkout and automated version bump write
|
||||
steps:
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v4
|
||||
- name: 🏗 Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.x
|
||||
- name: 📦 Install dependencies
|
||||
run: yarn install
|
||||
- name: 🏗 Setup EAS
|
||||
uses: expo/expo-github-action@main
|
||||
with:
|
||||
eas-version: latest
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
|
||||
# Get current fingerprint info and builds to check if we need to do a version bump
|
||||
- name: Get fingerprint info
|
||||
id: info
|
||||
uses: expo/expo-github-action/continuous-deploy-fingerprint-info@main
|
||||
with:
|
||||
profile: production
|
||||
|
||||
# If we do need to do a version bump, calculate the version to bump to. Note that this will vary greatly depending on your versioning preferences.
|
||||
- name: Get current version and calculate next version
|
||||
id: getversion
|
||||
if: ${{ github.event.head_commit.message != 'Automated version bump commit' && (steps.info.outputs.android-build-id == '' || steps.info.outputs.ios-build-id == '') }}
|
||||
run: |
|
||||
echo "currentversion=$(node -p "require('./app.json').expo.version")" >> $GITHUB_OUTPUT
|
||||
echo "nextversion=$(node -p "parseInt(require('./app.json').expo.version, 10) + 1 + '.0.0'")" >> $GITHUB_OUTPUT
|
||||
|
||||
# Bump the version. Note that this will vary greatly depending on your CNG and versioning preferences.
|
||||
- name: Bump Version
|
||||
id: bumpversion
|
||||
if: ${{ github.event.head_commit.message != 'Automated version bump commit' && (steps.info.outputs.android-build-id == '' || steps.info.outputs.ios-build-id == '') }}
|
||||
uses: restackio/[email protected]
|
||||
with:
|
||||
file: app.json
|
||||
fields: "{\"expo.version\": \"${{ steps.getversion.outputs.nextversion }}\"}"
|
||||
|
||||
# Commit and push the version bump to main.
|
||||
- name: Commit version bump
|
||||
id: commitversionbump
|
||||
if: ${{ github.event.head_commit.message != 'Automated version bump commit' && (steps.info.outputs.android-build-id == '' || steps.info.outputs.ios-build-id == '') }}
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "Automated version bump commit"
|
||||
|
||||
# Always continuously deploy. When no version bump is done (already have production builds for the fingerprint), this will solely deploy OTA updates.
|
||||
# When a version bump is done, this will kick off new production builds and auto-submit them to the app stores.
|
||||
# Important note: the above version buno commit doesn't trigger a new workflow run due to
|
||||
# https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
|
||||
# so it is safe to always continuously deploy here, it'll use the post-commit fingerprint. If instead it did kick off a new workflow run, we'd skip
|
||||
# this step here.
|
||||
- name: Continuously Deploy
|
||||
uses: expo/expo-github-action/continuous-deploy-fingerprint@main
|
||||
with:
|
||||
profile: production
|
||||
branch: production
|
||||
# auto-submit-builds: true
|
||||
```
|
||||
|
||||
<div align="center">
|
||||
<br />
|
||||
with :heart: <strong>Expo</strong>
|
||||
<br />
|
||||
</div>
|
||||
|
||||
[link-actions]: https://help.github.com/en/categories/automating-your-workflow-with-github-actions
|
||||
[link-gha-token]: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
|
||||
@@ -15,16 +15,6 @@ inputs:
|
||||
branch:
|
||||
description: The EAS Update branch on which to publish.
|
||||
required: true
|
||||
environment:
|
||||
description: The environment to use for server-side defined EAS environment variables during command execution
|
||||
required: false
|
||||
platform:
|
||||
description: The platform on which to publish. Possible values are 'all' | 'android' | 'ios'
|
||||
required: false
|
||||
default: all
|
||||
auto-submit-builds:
|
||||
description: Automatically submit new builds to their respective app stores using EAS Build `--auto-submit` flag (EAS Submit).
|
||||
required: false
|
||||
github-token:
|
||||
description: GitHub token to use when commenting on PR
|
||||
required: false
|
||||
@@ -40,12 +30,8 @@ outputs:
|
||||
ios-fingerprint:
|
||||
description: The iOS fingerprint of the current commit.
|
||||
android-build-id:
|
||||
description: ID for Android EAS Build with matching fingerprint.
|
||||
android-did-start-new-build:
|
||||
description: Whether this run of the action started a new Android EAS Build.
|
||||
description: ID for Android EAS Build if one was started
|
||||
ios-build-id:
|
||||
description: ID for iOS EAS Build with matching fingerprint.
|
||||
ios-did-start-new-build:
|
||||
description: Whether this run of the action started a new iOS EAS Build.
|
||||
description: ID for iOS EAS Build if one was started.
|
||||
update-output:
|
||||
description: The output (JSON) from the `eas update` command
|
||||
+8
-11
@@ -74,17 +74,14 @@ jobs:
|
||||
This action is customizable through variables defined in the [`action.yml`](action.yml).
|
||||
Here is a summary of all the input options you can use.
|
||||
|
||||
| variable | default | description |
|
||||
| ---------------------------------- | ---------------- | ------------------------------------------------------------------------------------------- |
|
||||
| **working-directory** | - | The relative directory of your Expo app |
|
||||
| **packager** | `yarn` | The package manager used to install the fingerprint tools |
|
||||
| **github-token** | `github.token` | GitHub token to use when commenting on PR ([read more](#github-tokens)) |
|
||||
| **fingerprint-version** | `latest` | `@expo/fingerprint` version to install |
|
||||
| **fingerprint-installation-cache** | `true` | If the `@expo/fingerprint` should be cached to speed up installation |
|
||||
| **fingerprint-db-cache-key** | `fingerprint-db` | A cache key to use for saving the fingerprint database |
|
||||
| **previous-git-commit** | - | The Git hash for the base commit |
|
||||
| **current-git-commit** | - | The Git hash for the current commit |
|
||||
| **saving-db-branch** | - | The branch for saving the fingerprint database. Defaults to the repository's default branch |
|
||||
| variable | default | description |
|
||||
| ---------------------------------- | ---------------- | ----------------------------------------------------------------------- |
|
||||
| **working-directory** | - | The relative directory of your Expo app |
|
||||
| **packager** | `yarn` | The package manager used to install the fingerprint tools |
|
||||
| **github-token** | `github.token` | GitHub token to use when commenting on PR ([read more](#github-tokens)) |
|
||||
| **fingerprint-version** | `latest` | `@expo/fingerprint` version to install |
|
||||
| **fingerprint-installation-cache** | `true` | If the `@expo/fingerprint` should be cached to speed up installation |
|
||||
| **fingerprint-db-cache-key** | `fingerprint-db` | A cache key to use for saving the fingerprint database |
|
||||
|
||||
And the action will generate these [outputs](#available-outputs) for other actions to do something based on current project fingerprint
|
||||
|
||||
|
||||
@@ -27,10 +27,7 @@ async function prebuild() {
|
||||
await fs.promises.rm(buildDir, { force: true, recursive: true });
|
||||
await fs.promises.rm(modulesDir, { force: true, recursive: true });
|
||||
|
||||
await spawn('bun', ['install', '--frozen-lockfile'], {
|
||||
stdio: 'inherit',
|
||||
env: { ...process.env, CI: true },
|
||||
});
|
||||
await spawn('bun', ['install', '--frozen-lockfile'], { stdio: 'inherit', env: { ...process.env, CI: true } });
|
||||
|
||||
console.log();
|
||||
}
|
||||
|
||||
+9
-3
@@ -40,12 +40,11 @@
|
||||
"@tsconfig/node20": "^20.1.2",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/node": "^16.18.11",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/uuid": "^9.0.3",
|
||||
"@vercel/ncc": "^0.36.0",
|
||||
"conventional-changelog-conventionalcommits": "^5.0.0",
|
||||
"eslint": "^8.54.0",
|
||||
"eslint-config-universe": "^13.0.0",
|
||||
"eslint-config-universe": "^12.0.0",
|
||||
"getenv": "^1.0.0",
|
||||
"jest": "^29.3.1",
|
||||
"jest-snapshot-prettier": "npm:prettier@^2.8.8",
|
||||
@@ -58,8 +57,15 @@
|
||||
"trustedDependencies": [
|
||||
"sqlite3"
|
||||
],
|
||||
"eslintConfig": {
|
||||
"extends": "universe/node",
|
||||
"ignorePatterns": [
|
||||
"build/**",
|
||||
"node_modules/**"
|
||||
]
|
||||
},
|
||||
"prettier": {
|
||||
"printWidth": 100,
|
||||
"printWidth": 120,
|
||||
"tabWidth": 2,
|
||||
"singleQuote": true,
|
||||
"bracketSameLine": true,
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { getInput, info, setFailed } from '@actions/core';
|
||||
|
||||
import {
|
||||
BuildInfo,
|
||||
appPlatformDisplayNames,
|
||||
appPlatformEmojis,
|
||||
BuildInfo,
|
||||
easBuild,
|
||||
getBuildLogsUrl,
|
||||
parseCommand,
|
||||
projectInfo,
|
||||
projectOwner,
|
||||
} from '../expo';
|
||||
import { Reaction, createIssueComment, createReaction, issueComment } from '../github';
|
||||
import { createIssueComment, createReaction, issueComment, Reaction } from '../github';
|
||||
import { template } from '../utils';
|
||||
import { executeAction } from '../worker';
|
||||
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
import { setFailed, setOutput } from '@actions/core';
|
||||
|
||||
import { getBuildInfoForCurrentFingerprintAsync } from '../fingerprintUtils';
|
||||
import { getInput } from '../input';
|
||||
import { loadProjectConfig } from '../project';
|
||||
import { executeAction } from '../worker';
|
||||
|
||||
type PlatformArg = 'android' | 'ios' | 'all';
|
||||
|
||||
export function collectContinousDeployFingerprintInfoInput() {
|
||||
function validatePlatformInput(platformInput: string): platformInput is PlatformArg {
|
||||
return ['android', 'ios', 'all'].includes(platformInput);
|
||||
}
|
||||
|
||||
const platformInput = getInput('platform', { required: true });
|
||||
if (!validatePlatformInput(platformInput)) {
|
||||
throw new Error(`Invalid platform: ${platformInput}. Must be one of "all", "ios", "android".`);
|
||||
}
|
||||
|
||||
return {
|
||||
profile: getInput('profile', { required: true }),
|
||||
platform: platformInput,
|
||||
environment: getInput('environment'),
|
||||
githubToken: getInput('github-token', { required: true }),
|
||||
workingDirectory: getInput('working-directory', { required: true }),
|
||||
};
|
||||
}
|
||||
|
||||
executeAction(continousDeployFingerprintInfoAction);
|
||||
|
||||
export async function continousDeployFingerprintInfoAction(
|
||||
input = collectContinousDeployFingerprintInfoInput()
|
||||
) {
|
||||
const config = await loadProjectConfig(input.workingDirectory, input.environment);
|
||||
const projectId = config.extra?.eas?.projectId;
|
||||
if (!projectId) {
|
||||
return setFailed(`Missing 'extra.eas.projectId' in app.json or app.config.js.`);
|
||||
}
|
||||
|
||||
const platformsToRun: Set<PlatformArg> =
|
||||
input.platform === 'all' ? new Set(['ios', 'android']) : new Set([input.platform]);
|
||||
|
||||
const [androidBuildInfo, iosBuildInfo] = await Promise.all([
|
||||
platformsToRun.has('android')
|
||||
? getBuildInfoForCurrentFingerprintAsync({
|
||||
platform: 'android',
|
||||
profile: input.profile,
|
||||
workingDirectory: input.workingDirectory,
|
||||
isInPullRequest: false,
|
||||
environment: input.environment,
|
||||
})
|
||||
: null,
|
||||
platformsToRun.has('ios')
|
||||
? getBuildInfoForCurrentFingerprintAsync({
|
||||
platform: 'ios',
|
||||
profile: input.profile,
|
||||
workingDirectory: input.workingDirectory,
|
||||
isInPullRequest: false,
|
||||
environment: input.environment,
|
||||
})
|
||||
: null,
|
||||
]);
|
||||
|
||||
setOutput('android-fingerprint', androidBuildInfo?.fingerprintHash);
|
||||
setOutput('ios-fingerprint', iosBuildInfo?.fingerprintHash);
|
||||
setOutput('android-build-id', androidBuildInfo?.buildInfo?.id);
|
||||
setOutput('ios-build-id', iosBuildInfo?.buildInfo?.id);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { info, isDebug, setFailed, setOutput } from '@actions/core';
|
||||
import { getInput, info, isDebug, setFailed, setOutput } from '@actions/core';
|
||||
import { getExecOutput } from '@actions/exec';
|
||||
import { which } from '@actions/io';
|
||||
import { ExpoConfig } from '@expo/config';
|
||||
@@ -6,98 +6,87 @@ import { ExpoConfig } from '@expo/config';
|
||||
import { createDetails, getQrTarget, getSchemesInOrderFromConfig } from '../comment';
|
||||
import { EasUpdate, getUpdateGroupQr, getUpdateGroupWebsite } from '../eas';
|
||||
import { AppPlatform, BuildInfo, appPlatformEmojis, getBuildLogsUrl } from '../expo';
|
||||
import { getBuildInfoForCurrentFingerprintAsync } from '../fingerprintUtils';
|
||||
import { createIssueComment, hasPullContext, pullContext } from '../github';
|
||||
import { getInput } from '../input';
|
||||
import { loadProjectConfig } from '../project';
|
||||
import { executeAction } from '../worker';
|
||||
|
||||
type BuildRunInfo = { buildInfo: BuildInfo; isNew: boolean; fingerprintHash: string };
|
||||
type PlatformArg = 'android' | 'ios' | 'all';
|
||||
|
||||
export function collectContinuousDeployFingerprintInput() {
|
||||
function validatePlatformInput(platformInput: string): platformInput is PlatformArg {
|
||||
return ['android', 'ios', 'all'].includes(platformInput);
|
||||
}
|
||||
|
||||
const platformInput = getInput('platform', { required: true });
|
||||
if (!validatePlatformInput(platformInput)) {
|
||||
throw new Error(`Invalid platform: ${platformInput}. Must be one of "all", "ios", "android".`);
|
||||
}
|
||||
|
||||
return {
|
||||
profile: getInput('profile', { required: true }),
|
||||
branch: getInput('branch', { required: true }),
|
||||
platform: platformInput,
|
||||
environment: getInput('environment'),
|
||||
autoSubmitBuilds: getInput('auto-submit-builds') === 'true',
|
||||
githubToken: getInput('github-token', { required: true }),
|
||||
workingDirectory: getInput('working-directory', { required: true }),
|
||||
profile: getInput('profile'),
|
||||
branch: getInput('branch'),
|
||||
githubToken: getInput('github-token'),
|
||||
workingDirectory: getInput('working-directory'),
|
||||
};
|
||||
}
|
||||
|
||||
executeAction(continuousDeployFingerprintAction);
|
||||
|
||||
export async function continuousDeployFingerprintAction(
|
||||
input = collectContinuousDeployFingerprintInput()
|
||||
) {
|
||||
export async function continuousDeployFingerprintAction(input = collectContinuousDeployFingerprintInput()) {
|
||||
const isInPullRequest = hasPullContext();
|
||||
|
||||
const config = await loadProjectConfig(input.workingDirectory, input.environment);
|
||||
const config = await loadProjectConfig(input.workingDirectory);
|
||||
const projectId = config.extra?.eas?.projectId;
|
||||
if (!projectId) {
|
||||
return setFailed(`Missing 'extra.eas.projectId' in app.json or app.config.js.`);
|
||||
}
|
||||
|
||||
const platformsToRun: Set<PlatformArg> =
|
||||
input.platform === 'all' ? new Set(['ios', 'android']) : new Set([input.platform]);
|
||||
const androidFingerprintHash = await getFingerprintHashForPlatformAsync({
|
||||
cwd: input.workingDirectory,
|
||||
platform: 'android',
|
||||
});
|
||||
const iosFingerprintHash = await getFingerprintHashForPlatformAsync({ cwd: input.workingDirectory, platform: 'ios' });
|
||||
|
||||
const [androidBuildRunInfo, iosBuildRunInfo] = await Promise.all([
|
||||
platformsToRun.has('android')
|
||||
? buildForPlatformIfNecessaryAsync({
|
||||
platform: 'android',
|
||||
profile: input.profile,
|
||||
workingDirectory: input.workingDirectory,
|
||||
isInPullRequest,
|
||||
environment: input.environment,
|
||||
autoSubmitBuild: input.autoSubmitBuilds,
|
||||
})
|
||||
: null,
|
||||
platformsToRun.has('ios')
|
||||
? buildForPlatformIfNecessaryAsync({
|
||||
platform: 'ios',
|
||||
profile: input.profile,
|
||||
workingDirectory: input.workingDirectory,
|
||||
isInPullRequest,
|
||||
environment: input.environment,
|
||||
autoSubmitBuild: input.autoSubmitBuilds,
|
||||
})
|
||||
: null,
|
||||
]);
|
||||
info(`Android fingerprint: ${androidFingerprintHash}`);
|
||||
info(`iOS fingerprint: ${iosFingerprintHash}`);
|
||||
|
||||
info('Looking for builds with matching runtime version (fingerprint)...');
|
||||
|
||||
let androidBuildInfo = await getBuildInfoWithFingerprintAsync({
|
||||
cwd: input.workingDirectory,
|
||||
platform: 'android',
|
||||
profile: input.profile,
|
||||
fingerprintHash: androidFingerprintHash,
|
||||
excludeExpiredBuilds: isInPullRequest,
|
||||
});
|
||||
if (androidBuildInfo) {
|
||||
info(`Existing Android build found with matching fingerprint: ${androidBuildInfo.id}`);
|
||||
} else {
|
||||
info(`No existing Android build found for fingerprint, starting a new build...`);
|
||||
androidBuildInfo = await createEASBuildAsync({
|
||||
cwd: input.workingDirectory,
|
||||
platform: 'android',
|
||||
profile: input.profile,
|
||||
});
|
||||
}
|
||||
|
||||
let iosBuildInfo = await getBuildInfoWithFingerprintAsync({
|
||||
cwd: input.workingDirectory,
|
||||
platform: 'ios',
|
||||
profile: input.profile,
|
||||
fingerprintHash: iosFingerprintHash,
|
||||
excludeExpiredBuilds: isInPullRequest,
|
||||
});
|
||||
if (iosBuildInfo) {
|
||||
info(`Existing iOS build found with matching fingerprint: ${iosBuildInfo.id}`);
|
||||
} else {
|
||||
info(`No existing iOS build found for fingerprint, starting a new build...`);
|
||||
iosBuildInfo = await createEASBuildAsync({ cwd: input.workingDirectory, platform: 'ios', profile: input.profile });
|
||||
}
|
||||
|
||||
const builds = [androidBuildInfo, iosBuildInfo];
|
||||
|
||||
info(`Publishing EAS Update...`);
|
||||
|
||||
const updates = await publishEASUpdatesAsync({
|
||||
cwd: input.workingDirectory,
|
||||
branch: input.branch,
|
||||
platform: input.platform,
|
||||
environment: input.environment,
|
||||
});
|
||||
|
||||
if (!isInPullRequest) {
|
||||
info(`Skipped comment: action was not run from a pull request`);
|
||||
} else {
|
||||
const messageId = `continuous-deploy-fingerprint-projectId:${projectId}`;
|
||||
const messageBody = createSummaryForUpdatesAndBuilds({
|
||||
config,
|
||||
projectId,
|
||||
updates,
|
||||
buildRunInfos: {
|
||||
androidBuildRunInfo: androidBuildRunInfo ?? undefined,
|
||||
iosBuildRunInfo: iosBuildRunInfo ?? undefined,
|
||||
},
|
||||
options: input,
|
||||
});
|
||||
const messageBody = createSummaryForUpdatesAndBuilds({ config, projectId, updates, builds, options: input });
|
||||
|
||||
await createIssueComment({
|
||||
...pullContext(),
|
||||
@@ -107,139 +96,148 @@ export async function continuousDeployFingerprintAction(
|
||||
});
|
||||
}
|
||||
|
||||
setOutput('android-fingerprint', androidBuildRunInfo?.fingerprintHash);
|
||||
setOutput('ios-fingerprint', iosBuildRunInfo?.fingerprintHash);
|
||||
setOutput('android-build-id', androidBuildRunInfo?.buildInfo.id);
|
||||
setOutput('android-did-start-new-build', androidBuildRunInfo?.isNew);
|
||||
setOutput('ios-build-id', iosBuildRunInfo?.buildInfo?.id);
|
||||
setOutput('ios-did-start-new-build', iosBuildRunInfo?.isNew);
|
||||
|
||||
setOutput('android-fingerprint', androidFingerprintHash);
|
||||
setOutput('ios-fingerprint', iosFingerprintHash);
|
||||
setOutput('android-build-id', androidBuildInfo.id);
|
||||
setOutput('ios-build-id', iosBuildInfo.id);
|
||||
setOutput('update-output', updates);
|
||||
}
|
||||
|
||||
async function buildForPlatformIfNecessaryAsync({
|
||||
async function getFingerprintHashForPlatformAsync({
|
||||
cwd,
|
||||
platform,
|
||||
workingDirectory,
|
||||
profile,
|
||||
isInPullRequest,
|
||||
environment,
|
||||
autoSubmitBuild,
|
||||
}: {
|
||||
cwd: string;
|
||||
platform: 'ios' | 'android';
|
||||
profile: string;
|
||||
workingDirectory: string;
|
||||
isInPullRequest: boolean;
|
||||
environment: string | null;
|
||||
autoSubmitBuild: boolean;
|
||||
}): Promise<BuildRunInfo> {
|
||||
const humanReadablePlatformName = platform === 'ios' ? 'iOS' : 'Android';
|
||||
|
||||
const { buildInfo: existingBuildInfo, fingerprintHash } =
|
||||
await getBuildInfoForCurrentFingerprintAsync({
|
||||
workingDirectory,
|
||||
platform,
|
||||
profile,
|
||||
isInPullRequest,
|
||||
environment,
|
||||
});
|
||||
if (existingBuildInfo) {
|
||||
info(
|
||||
`Existing ${humanReadablePlatformName} build found with matching fingerprint: ${existingBuildInfo.id}`
|
||||
}): Promise<string> {
|
||||
try {
|
||||
const extraArgs = isDebug() ? ['--debug'] : [];
|
||||
const { stdout } = await getExecOutput(
|
||||
'npx',
|
||||
['expo-updates', 'fingerprint:generate', '--platform', platform, ...extraArgs],
|
||||
{
|
||||
cwd,
|
||||
silent: !isDebug(),
|
||||
}
|
||||
);
|
||||
return {
|
||||
buildInfo: existingBuildInfo,
|
||||
isNew: false,
|
||||
fingerprintHash,
|
||||
};
|
||||
} else {
|
||||
info(
|
||||
`No existing ${humanReadablePlatformName} build found for fingerprint, starting a new build...`
|
||||
);
|
||||
return {
|
||||
buildInfo: await createEASBuildAsync({
|
||||
cwd: workingDirectory,
|
||||
platform,
|
||||
profile,
|
||||
autoSubmit: autoSubmitBuild,
|
||||
}),
|
||||
isNew: true,
|
||||
fingerprintHash,
|
||||
};
|
||||
const { hash } = JSON.parse(stdout);
|
||||
if (!hash || typeof hash !== 'string') {
|
||||
throw new Error(`Invalid fingerprint output: ${stdout}`);
|
||||
}
|
||||
return hash;
|
||||
} catch (error: unknown) {
|
||||
throw new Error(`Could not get fingerprint for project: ${String(error)}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function createEASBuildAsync({
|
||||
async function getBuildInfoWithFingerprintAsync({
|
||||
cwd,
|
||||
profile,
|
||||
platform,
|
||||
autoSubmit,
|
||||
profile,
|
||||
fingerprintHash,
|
||||
excludeExpiredBuilds,
|
||||
}: {
|
||||
cwd: string;
|
||||
profile: string;
|
||||
platform: 'ios' | 'android';
|
||||
autoSubmit: boolean;
|
||||
}): Promise<BuildInfo> {
|
||||
profile: string;
|
||||
fingerprintHash: string;
|
||||
excludeExpiredBuilds: boolean;
|
||||
}): Promise<BuildInfo | null> {
|
||||
let stdout: string;
|
||||
try {
|
||||
const extraDebugArgs = isDebug() ? ['--build-logger-level', 'debug'] : [];
|
||||
const extraAutoSubmitArgs = autoSubmit ? ['--auto-submit'] : [];
|
||||
const { stdout } = await getExecOutput(
|
||||
const execOutput = await getExecOutput(
|
||||
await which('eas', true),
|
||||
[
|
||||
'build',
|
||||
'--profile',
|
||||
profile,
|
||||
'build:list',
|
||||
'--platform',
|
||||
platform,
|
||||
'--non-interactive',
|
||||
'--status',
|
||||
'finished',
|
||||
'--buildProfile',
|
||||
profile,
|
||||
'--runtimeVersion',
|
||||
fingerprintHash,
|
||||
'--limit',
|
||||
'1',
|
||||
'--json',
|
||||
'--no-wait',
|
||||
...extraDebugArgs,
|
||||
...extraAutoSubmitArgs,
|
||||
'--non-interactive',
|
||||
],
|
||||
{
|
||||
cwd,
|
||||
silent: !isDebug(),
|
||||
}
|
||||
);
|
||||
return JSON.parse(stdout)[0];
|
||||
stdout = execOutput.stdout;
|
||||
} catch (error: unknown) {
|
||||
throw new Error(`Error running eas build command: ${String(error)}`, { cause: error });
|
||||
throw new Error(`Could not list project builds: ${String(error)}`);
|
||||
}
|
||||
|
||||
const builds = JSON.parse(stdout);
|
||||
if (!builds || !Array.isArray(builds)) {
|
||||
throw new Error(`Could not get EAS builds for project`);
|
||||
}
|
||||
|
||||
if (!builds[0]) {
|
||||
return null;
|
||||
}
|
||||
|
||||
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 publishEASUpdatesAsync({
|
||||
async function createEASBuildAsync({
|
||||
cwd,
|
||||
branch,
|
||||
environment,
|
||||
profile,
|
||||
platform,
|
||||
}: {
|
||||
cwd: string;
|
||||
branch: string;
|
||||
environment: string | null;
|
||||
platform: PlatformArg;
|
||||
}): Promise<EasUpdate[]> {
|
||||
profile: string;
|
||||
platform: 'ios' | 'android';
|
||||
}): Promise<BuildInfo> {
|
||||
let stdout: string;
|
||||
try {
|
||||
const args = [
|
||||
'update',
|
||||
'--auto',
|
||||
'--branch',
|
||||
branch,
|
||||
'--platform',
|
||||
platform,
|
||||
'--non-interactive',
|
||||
'--json',
|
||||
];
|
||||
if (environment) {
|
||||
args.push('--environment', environment);
|
||||
}
|
||||
const execOutput = await getExecOutput(await which('eas', true), args, {
|
||||
cwd,
|
||||
silent: !isDebug(),
|
||||
});
|
||||
const extraArgs = isDebug() ? ['--build-logger-level', 'debug'] : [];
|
||||
const execOutput = await getExecOutput(
|
||||
await which('eas', true),
|
||||
['build', '--profile', profile, '--platform', platform, '--non-interactive', '--json', '--no-wait', ...extraArgs],
|
||||
{
|
||||
cwd,
|
||||
silent: !isDebug(),
|
||||
}
|
||||
);
|
||||
stdout = execOutput.stdout;
|
||||
} catch (error: unknown) {
|
||||
throw new Error(`Error running eas update command: ${String(error)}`, { cause: error });
|
||||
throw new Error(`Could not run command eas build: ${String(error)}`);
|
||||
}
|
||||
|
||||
return JSON.parse(stdout)[0];
|
||||
}
|
||||
|
||||
async function publishEASUpdatesAsync({ cwd, branch }: { cwd: string; branch: string }): Promise<EasUpdate[]> {
|
||||
let stdout: string;
|
||||
try {
|
||||
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)}`);
|
||||
}
|
||||
|
||||
return JSON.parse(stdout);
|
||||
@@ -249,20 +247,21 @@ function createSummaryForUpdatesAndBuilds({
|
||||
config,
|
||||
projectId,
|
||||
updates,
|
||||
buildRunInfos,
|
||||
builds,
|
||||
options,
|
||||
}: {
|
||||
config: ExpoConfig;
|
||||
projectId: string;
|
||||
updates: EasUpdate[];
|
||||
buildRunInfos: { androidBuildRunInfo?: BuildRunInfo; iosBuildRunInfo?: BuildRunInfo };
|
||||
builds: BuildInfo[];
|
||||
options: { qrTarget?: 'expo-go' | 'dev-build' | 'dev-client'; workingDirectory: string };
|
||||
}) {
|
||||
const appSlug = config.slug;
|
||||
const qrTarget = getQrTarget(options);
|
||||
const appSchemes = getSchemesInOrderFromConfig(config) || [];
|
||||
|
||||
const { androidBuildRunInfo, iosBuildRunInfo } = buildRunInfos;
|
||||
const androidBuild = builds.find(build => build.platform === AppPlatform.Android);
|
||||
const iosBuild = builds.find(build => build.platform === AppPlatform.Ios);
|
||||
|
||||
const androidUpdate = updates.find(update => update.platform === 'android');
|
||||
const iosUpdate = updates.find(update => update.platform === 'ios');
|
||||
@@ -270,25 +269,25 @@ function createSummaryForUpdatesAndBuilds({
|
||||
const getBuildLink = (build: BuildInfo | undefined) =>
|
||||
build ? `[Build Permalink](${getBuildLogsUrl(build)})` : 'n/a';
|
||||
const getUpdateLink = (update: EasUpdate | undefined) =>
|
||||
update
|
||||
? `[Update Permalink](${getUpdateGroupWebsite({ projectId, updateGroupId: update.group })})`
|
||||
: 'n/a';
|
||||
update ? `[Update Permalink](${getUpdateGroupWebsite({ projectId, updateGroupId: update.group })})` : 'n/a';
|
||||
const getUpdateQRURL = (update: EasUpdate | undefined) =>
|
||||
update ? getUpdateGroupQr({ projectId, updateGroupId: update.group, appSlug, qrTarget }) : null;
|
||||
const getBuildDetails = (buildRunInfo: BuildRunInfo) =>
|
||||
getBuildLink(buildRunInfo.buildInfo) +
|
||||
'<br />' +
|
||||
createDetails({
|
||||
summary: 'Details',
|
||||
details: [
|
||||
`Distribution: \`${buildRunInfo.buildInfo.distribution}\``,
|
||||
`Build profile: \`${buildRunInfo.buildInfo.buildProfile}\``,
|
||||
`Runtime version: \`${buildRunInfo.buildInfo.runtimeVersion}\``,
|
||||
`App version: \`${buildRunInfo.buildInfo.appVersion}\``,
|
||||
`Git commit: \`${buildRunInfo.buildInfo.gitCommitHash}\``,
|
||||
].join('<br />'),
|
||||
delim: '',
|
||||
});
|
||||
const getBuildDetails = (build: BuildInfo | undefined) =>
|
||||
build
|
||||
? getBuildLink(build) +
|
||||
'<br />' +
|
||||
createDetails({
|
||||
summary: 'Details',
|
||||
details: [
|
||||
`Distribution: \`${build.distribution}\``,
|
||||
`Build profile: \`${build.buildProfile}\``,
|
||||
`Runtime version: \`${build.runtimeVersion}\``,
|
||||
`App version: \`${build.appVersion}\``,
|
||||
`Git commit: \`${build.gitCommitHash}\``,
|
||||
].join('<br />'),
|
||||
delim: '',
|
||||
})
|
||||
: 'n/a';
|
||||
const getUpdateDetails = (update: EasUpdate | undefined) =>
|
||||
update
|
||||
? getUpdateLink(update) +
|
||||
@@ -311,9 +310,7 @@ function createSummaryForUpdatesAndBuilds({
|
||||
? `<a href="${androidQRURL}"><img src="${androidQRURL}" width="250px" height="250px" /></a>`
|
||||
: null;
|
||||
|
||||
const iosQr = iosQRURL
|
||||
? `<a href="${iosQRURL}"><img src="${iosQRURL}" width="250px" height="250px" /></a>`
|
||||
: null;
|
||||
const iosQr = iosQRURL ? `<a href="${iosQRURL}"><img src="${iosQRURL}" width="250px" height="250px" /></a>` : null;
|
||||
|
||||
const platformName = `Platform${updates.length === 1 ? '' : 's'}`;
|
||||
const platformValue = updates
|
||||
@@ -330,16 +327,10 @@ function createSummaryForUpdatesAndBuilds({
|
||||
- ${platformName} → ${platformValue}
|
||||
${schemesMessage}
|
||||
|
||||
| ${appPlatformEmojis[AppPlatform.Android]} Android | ${
|
||||
appPlatformEmojis[AppPlatform.Ios]
|
||||
} iOS
|
||||
| ${appPlatformEmojis[AppPlatform.Android]} Android | ${appPlatformEmojis[AppPlatform.Ios]} iOS
|
||||
--- | --- | ---
|
||||
Fingerprint | ${androidBuildRunInfo?.buildInfo.runtimeVersion ?? 'n/a'} | ${
|
||||
iosBuildRunInfo?.buildInfo.runtimeVersion ?? 'n/a'
|
||||
}
|
||||
Build Details | ${androidBuildRunInfo ? getBuildDetails(androidBuildRunInfo) : 'n/a'} | ${
|
||||
iosBuildRunInfo ? getBuildDetails(iosBuildRunInfo) : 'n/a'
|
||||
}
|
||||
Fingerprint | ${androidBuild?.runtimeVersion ?? 'n/a'} | ${iosBuild?.runtimeVersion ?? 'n/a'}
|
||||
Build Details | ${getBuildDetails(androidBuild)} | ${getBuildDetails(iosBuild)}
|
||||
Update Details | ${getUpdateDetails(androidUpdate)} | ${getUpdateDetails(iosUpdate)}
|
||||
Update QR | ${androidQr ?? 'n/a'} | ${iosQr ?? 'n/a'}
|
||||
`;
|
||||
|
||||
@@ -1,23 +1,17 @@
|
||||
import { setOutput } from '@actions/core';
|
||||
|
||||
import {
|
||||
createFingerprintOutputAsync,
|
||||
collectFingerprintActionInput,
|
||||
createFingerprintDbManagerAsync,
|
||||
createFingerprintOutputAsync,
|
||||
} from '../fingerprint';
|
||||
import { executeAction } from '../worker';
|
||||
|
||||
executeAction(runAction);
|
||||
|
||||
export async function runAction(input = collectFingerprintActionInput()) {
|
||||
const dbManager = await createFingerprintDbManagerAsync(
|
||||
input.packager,
|
||||
input.fingerprintDbCacheKey
|
||||
);
|
||||
const { currentFingerprint, previousFingerprint, diff } = await createFingerprintOutputAsync(
|
||||
dbManager,
|
||||
input
|
||||
);
|
||||
const dbManager = await createFingerprintDbManagerAsync(input.packager, input.fingerprintDbCacheKey);
|
||||
const { currentFingerprint, previousFingerprint, diff } = await createFingerprintOutputAsync(dbManager, input);
|
||||
await dbManager.upsertFingerprintByGitCommitHashAsync(input.currentGitCommitHash, {
|
||||
fingerprint: currentFingerprint,
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getBooleanInput, getInput, group, info, setFailed, setOutput } from '@actions/core';
|
||||
import { getBooleanInput, getInput, setOutput, group, setFailed, info } from '@actions/core';
|
||||
import { context } from '@actions/github';
|
||||
import type { ExpoConfig } from '@expo/config';
|
||||
import type { Fingerprint, FingerprintSource } from '@expo/fingerprint';
|
||||
@@ -8,11 +8,11 @@ import { validate as isValidUUID } from 'uuid';
|
||||
import { deleteCacheAsync } from '../cacher';
|
||||
import { createDetails } from '../comment';
|
||||
import {
|
||||
createEasBuildFromRawCommandAsync,
|
||||
BuildInfo,
|
||||
getBuildLogsUrl,
|
||||
appPlatformEmojis,
|
||||
cancelEasBuildAsync,
|
||||
createEasBuildFromRawCommandAsync,
|
||||
getBuildLogsUrl,
|
||||
queryEasBuildInfoAsync,
|
||||
} from '../expo';
|
||||
import {
|
||||
@@ -51,7 +51,7 @@ export function collectPreviewBuildActionInput() {
|
||||
executeAction(previewAction);
|
||||
|
||||
export async function previewAction(input = collectPreviewBuildActionInput()) {
|
||||
const config = await loadProjectConfig(input.workingDirectory, null);
|
||||
const config = await loadProjectConfig(input.workingDirectory);
|
||||
if (!config.extra?.eas?.projectId) {
|
||||
return setFailed(
|
||||
'Missing "extra.eas.projectId" in app.json or app.config.js. Please run `eas build:configure` first.'
|
||||
@@ -63,10 +63,7 @@ export async function previewAction(input = collectPreviewBuildActionInput()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const dbManager = await createFingerprintDbManagerAsync(
|
||||
input.packager,
|
||||
input.fingerprintDbCacheKey
|
||||
);
|
||||
const dbManager = await createFingerprintDbManagerAsync(input.packager, input.fingerprintDbCacheKey);
|
||||
const { currentFingerprint, diff } = await createFingerprintOutputAsync(dbManager, input);
|
||||
if (diff.length === 0) {
|
||||
info('Fingerprint is compatible, no new builds are required.');
|
||||
@@ -81,9 +78,7 @@ export async function previewAction(input = collectPreviewBuildActionInput()) {
|
||||
await maybeCancelPreviousBuildsAsync(config, input);
|
||||
const variables = getVariables(config, []);
|
||||
const messageId = template(input.commentId, variables);
|
||||
const latestEasEntity = await dbManager.getLatestEasEntityFromFingerprintAsync(
|
||||
currentFingerprint.hash
|
||||
);
|
||||
const latestEasEntity = await dbManager.getLatestEasEntityFromFingerprintAsync(currentFingerprint.hash);
|
||||
const latestEasBuildInfo = latestEasEntity?.easBuildId
|
||||
? await queryEasBuildInfoAsync(input.workingDirectory, latestEasEntity.easBuildId)
|
||||
: null;
|
||||
@@ -180,11 +175,7 @@ async function maybeCreateCommentAsync(
|
||||
}
|
||||
}
|
||||
|
||||
function setOutputs(
|
||||
variables: ReturnType<typeof getVariables>,
|
||||
messageId: string,
|
||||
messageBody: string
|
||||
) {
|
||||
function setOutputs(variables: ReturnType<typeof getVariables>, messageId: string, messageBody: string) {
|
||||
for (const [name, value] of Object.entries(variables)) {
|
||||
setOutput(name, value);
|
||||
}
|
||||
@@ -342,10 +333,7 @@ async function maybeUpdateFingerprintDbAsync(params: {
|
||||
|
||||
//#region Non pull request context
|
||||
|
||||
async function handleNonPullRequest(
|
||||
config: ExpoConfig,
|
||||
input: ReturnType<typeof collectPreviewBuildActionInput>
|
||||
) {
|
||||
async function handleNonPullRequest(config: ExpoConfig, input: ReturnType<typeof collectPreviewBuildActionInput>) {
|
||||
info('Non pull request context, skipping comment.');
|
||||
const targetBranch = input.savingDbBranch ?? getRepoDefaultBranch();
|
||||
assert(targetBranch);
|
||||
@@ -354,19 +342,14 @@ async function handleNonPullRequest(
|
||||
}
|
||||
|
||||
info(`Updating fingerprint database for the ${targetBranch} branch push event.`);
|
||||
const dbManager = await createFingerprintDbManagerAsync(
|
||||
input.packager,
|
||||
input.fingerprintDbCacheKey
|
||||
);
|
||||
const dbManager = await createFingerprintDbManagerAsync(input.packager, input.fingerprintDbCacheKey);
|
||||
const { currentFingerprint } = await createFingerprintOutputAsync(dbManager, input);
|
||||
const associatedPRs = await getPullRequestFromGitCommitShaAsync(
|
||||
{ token: input.githubToken },
|
||||
input.currentGitCommitHash
|
||||
);
|
||||
const easBuildIds = (
|
||||
await Promise.all(
|
||||
associatedPRs.map(pr => queryEasBuildIdsFromPrAsync(pr.prNumber, config, input))
|
||||
)
|
||||
await Promise.all(associatedPRs.map(pr => queryEasBuildIdsFromPrAsync(pr.prNumber, config, input)))
|
||||
).flat();
|
||||
|
||||
let manyBuilds: { easBuildId?: string; fingerprint: Fingerprint }[];
|
||||
@@ -378,9 +361,7 @@ async function handleNonPullRequest(
|
||||
info(`Found EAS build IDs in associated PRs: ${easBuildIds.join(', ')}`);
|
||||
} else {
|
||||
manyBuilds = [{ fingerprint: currentFingerprint }];
|
||||
info(
|
||||
'No EAS build IDs found in associated PRs, creating a fingerprint entry without EAS build ID.'
|
||||
);
|
||||
info('No EAS build IDs found in associated PRs, creating a fingerprint entry without EAS build ID.');
|
||||
}
|
||||
|
||||
await maybeUpdateFingerprintDbAsync({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getBooleanInput, getInput, info, setOutput, warning } from '@actions/core';
|
||||
import { getBooleanInput, getInput, setOutput, info, warning } from '@actions/core';
|
||||
|
||||
import { projectDeepLink, projectInfo, projectLink, projectOwner, projectQR } from '../expo';
|
||||
import { createIssueComment, pullContext } from '../github';
|
||||
|
||||
+7
-23
@@ -1,14 +1,8 @@
|
||||
import { getBooleanInput, getInput, group, info, setFailed, setOutput } from '@actions/core';
|
||||
import { getBooleanInput, getInput, setOutput, group, setFailed, info } from '@actions/core';
|
||||
import { ExpoConfig } from '@expo/config';
|
||||
|
||||
import { getQrTarget, getSchemesInOrderFromConfig } from '../comment';
|
||||
import {
|
||||
EasUpdate,
|
||||
assertEasVersion,
|
||||
createUpdate,
|
||||
getUpdateGroupQr,
|
||||
getUpdateGroupWebsite,
|
||||
} from '../eas';
|
||||
import { assertEasVersion, createUpdate, EasUpdate, getUpdateGroupQr, getUpdateGroupWebsite } from '../eas';
|
||||
import { createIssueComment, hasPullContext, pullContext } from '../github';
|
||||
import { loadProjectConfig } from '../project';
|
||||
import { template } from '../utils';
|
||||
@@ -44,16 +38,14 @@ export async function previewAction(input = previewInput()) {
|
||||
// Create the update before loading project information.
|
||||
// When the project needs to be set up, EAS project ID won't be available before this command.
|
||||
const command = sanitizeCommand(input.command);
|
||||
const updates = await group(`Run eas ${command}"`, () =>
|
||||
createUpdate(input.workingDirectory, command)
|
||||
);
|
||||
const updates = await group(`Run eas ${command}"`, () => createUpdate(input.workingDirectory, command));
|
||||
|
||||
const update = updates.find(update => !!update);
|
||||
if (!update) {
|
||||
return setFailed(`No update found in command output.`);
|
||||
}
|
||||
|
||||
const config = await loadProjectConfig(input.workingDirectory, null);
|
||||
const config = await loadProjectConfig(input.workingDirectory);
|
||||
if (!config.extra?.eas?.projectId) {
|
||||
return setFailed(`Missing 'extra.eas.projectId' in app.json or app.config.js.`);
|
||||
}
|
||||
@@ -111,11 +103,7 @@ function sanitizeCommand(input: string): string {
|
||||
/**
|
||||
* Generate useful variables for the message body, and as step outputs.
|
||||
*/
|
||||
export function getVariables(
|
||||
config: ExpoConfig,
|
||||
updates: EasUpdate[],
|
||||
options: ReturnType<typeof previewInput>
|
||||
) {
|
||||
export function getVariables(config: ExpoConfig, updates: EasUpdate[], options: ReturnType<typeof previewInput>) {
|
||||
const projectId: string = config.extra?.eas?.projectId;
|
||||
const android = updates.find(update => update.platform === 'android');
|
||||
const ios = updates.find(update => update.platform === 'ios');
|
||||
@@ -149,9 +137,7 @@ export function getVariables(
|
||||
androidManifestPermalink: android?.manifestPermalink || '',
|
||||
androidMessage: android?.message || '',
|
||||
androidRuntimeVersion: android?.runtimeVersion || '',
|
||||
androidQR: android
|
||||
? getUpdateGroupQr({ projectId, updateGroupId: android.group, appSlug, qrTarget })
|
||||
: '',
|
||||
androidQR: android ? getUpdateGroupQr({ projectId, updateGroupId: android.group, appSlug, qrTarget }) : '',
|
||||
androidLink: android ? getUpdateGroupWebsite({ projectId, updateGroupId: android.group }) : '',
|
||||
// iOS update
|
||||
iosId: ios?.id || '',
|
||||
@@ -186,9 +172,7 @@ function createSummaryHeader(updates: EasUpdate[], vars: ReturnType<typeof getVa
|
||||
.map(platform => `**${platform}**`)
|
||||
.join(', ');
|
||||
|
||||
const appSchemes = vars.projectScheme
|
||||
? `- Scheme → **${JSON.parse(vars.projectSchemes).join('**, **')}**`
|
||||
: '';
|
||||
const appSchemes = vars.projectScheme ? `- Scheme → **${JSON.parse(vars.projectSchemes).join('**, **')}**` : '';
|
||||
|
||||
return `🚀 Expo preview is ready!
|
||||
|
||||
|
||||
+3
-10
@@ -1,4 +1,4 @@
|
||||
import { ReserveCacheError, isFeatureAvailable, restoreCache, saveCache } from '@actions/cache';
|
||||
import { saveCache, restoreCache, ReserveCacheError, isFeatureAvailable } from '@actions/cache';
|
||||
import { warning } from '@actions/core';
|
||||
import { context } from '@actions/github';
|
||||
import os from 'os';
|
||||
@@ -24,10 +24,7 @@ export function cacheKey(name: string, version: string, manager: string): string
|
||||
/**
|
||||
* Restore a directory from the remote cache.
|
||||
*/
|
||||
export async function restoreCacheAsync(
|
||||
cachePath: string,
|
||||
cacheKey: string
|
||||
): Promise<string | null> {
|
||||
export async function restoreCacheAsync(cachePath: string, cacheKey: string): Promise<string | null> {
|
||||
if (!cacheIsAvailable()) {
|
||||
warning(`Skipped restoring from remote cache, not available.`);
|
||||
return null;
|
||||
@@ -63,11 +60,7 @@ export async function saveCacheAsync(cachePath: string, cacheKey: string): Promi
|
||||
* Delete a cache key from the remote cache.
|
||||
* Note that is not using the official API from @actions/cache but using the GitHub API directly.
|
||||
*/
|
||||
export async function deleteCacheAsync(
|
||||
githubToken: string,
|
||||
cacheKey: string,
|
||||
ref: string
|
||||
): Promise<void> {
|
||||
export async function deleteCacheAsync(githubToken: string, cacheKey: string, ref: string): Promise<void> {
|
||||
const github = githubApi({ token: githubToken });
|
||||
await github.rest.actions.deleteActionsCacheByKey({
|
||||
...context.repo,
|
||||
|
||||
+2
-7
@@ -3,10 +3,7 @@ import { ExpoConfig } from '@expo/config';
|
||||
|
||||
import { projectAppType } from './expo';
|
||||
|
||||
export function getQrTarget(input: {
|
||||
qrTarget?: 'expo-go' | 'dev-build' | 'dev-client';
|
||||
workingDirectory: string;
|
||||
}) {
|
||||
export function getQrTarget(input: { qrTarget?: 'expo-go' | 'dev-build' | 'dev-client'; workingDirectory: string }) {
|
||||
if (!input.qrTarget) {
|
||||
const appType = projectAppType(input.workingDirectory);
|
||||
debug(`Using inferred QR code target: "${appType}"`);
|
||||
@@ -25,9 +22,7 @@ export function getQrTarget(input: {
|
||||
return 'expo-go';
|
||||
|
||||
default:
|
||||
throw new Error(
|
||||
`Invalid QR code target: "${input.qrTarget}", expected "expo-go" or "dev-build"`
|
||||
);
|
||||
throw new Error(`Invalid QR code target: "${input.qrTarget}", expected "expo-go" or "dev-build"`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-10
@@ -32,13 +32,11 @@ export async function assertEasVersion(versionRange: string) {
|
||||
try {
|
||||
({ stdout } = await getExecOutput(await which('eas', true), ['--version']));
|
||||
} catch {
|
||||
throw new Error(
|
||||
`Could not verify the EAS CLI version, reason:\nCommand failed 'eas --version'`
|
||||
);
|
||||
throw new Error(`Could not verify the EAS CLI version, reason:\nCommand failed 'eas --version'`);
|
||||
}
|
||||
|
||||
const version = stdout.match(/eas-cli\/([^\s]+)/i);
|
||||
if (!version?.[1]) {
|
||||
if (!version || !version[1]) {
|
||||
throw new Error(`Could not verify the EAS CLI version, reason:\nUnexpected output received.`);
|
||||
}
|
||||
|
||||
@@ -90,10 +88,6 @@ export function getUpdateGroupQr({
|
||||
url.searchParams.append('appScheme', appSlug.replace(/[^A-Za-z0-9+\-.]/g, ''));
|
||||
}
|
||||
|
||||
if (process.env.EXPO_STAGING) {
|
||||
url.searchParams.append('host', 'staging-u.expo.dev');
|
||||
}
|
||||
|
||||
url.searchParams.append('projectId', projectId);
|
||||
url.searchParams.append('groupId', updateGroupId);
|
||||
|
||||
@@ -108,6 +102,5 @@ export function getUpdateGroupWebsite({
|
||||
projectId: string;
|
||||
updateGroupId: string;
|
||||
}): string {
|
||||
const baseUrl = process.env.EXPO_STAGING ? 'staging.expo.dev' : 'expo.dev';
|
||||
return `https://${baseUrl}/projects/${projectId}/updates/${updateGroupId}`;
|
||||
return `https://expo.dev/projects/${projectId}/updates/${updateGroupId}`;
|
||||
}
|
||||
+21
-46
@@ -1,4 +1,4 @@
|
||||
import { exportVariable, info } from '@actions/core';
|
||||
import { info, exportVariable } from '@actions/core';
|
||||
import { exec, getExecOutput } from '@actions/exec';
|
||||
import { which } from '@actions/io';
|
||||
import { ok as assert } from 'assert';
|
||||
@@ -25,16 +25,6 @@ export enum AppPlatform {
|
||||
Ios = 'IOS',
|
||||
}
|
||||
|
||||
export enum BuildStatus {
|
||||
New = 'NEW',
|
||||
InQueue = 'IN_QUEUE',
|
||||
InProgress = 'IN_PROGRESS',
|
||||
PendingCancel = 'PENDING_CANCEL',
|
||||
Errored = 'ERRORED',
|
||||
Finished = 'FINISHED',
|
||||
Canceled = 'CANCELED',
|
||||
}
|
||||
|
||||
export type BuildInfo = {
|
||||
id: string;
|
||||
platform: AppPlatform;
|
||||
@@ -53,7 +43,6 @@ export type BuildInfo = {
|
||||
appVersion: string;
|
||||
gitCommitHash: string;
|
||||
expirationDate: string;
|
||||
status: BuildStatus;
|
||||
};
|
||||
|
||||
export const appPlatformDisplayNames: Record<AppPlatform, string> = {
|
||||
@@ -128,13 +117,9 @@ export async function runCommand(cmd: Command) {
|
||||
let stderr = '';
|
||||
|
||||
try {
|
||||
({ stderr, stdout } = await getExecOutput(
|
||||
await which(cmd.cli),
|
||||
cmd.args.concat('--non-interactive'),
|
||||
{
|
||||
silent: false,
|
||||
}
|
||||
));
|
||||
({ stderr, stdout } = await getExecOutput(await which(cmd.cli), cmd.args.concat('--non-interactive'), {
|
||||
silent: false,
|
||||
}));
|
||||
} catch (error: unknown) {
|
||||
throw new Error(`Could not run command ${cmd.args.join(' ')}`, { cause: error });
|
||||
}
|
||||
@@ -203,19 +188,12 @@ export async function cancelEasBuildAsync(cwd: string, buildId: string): Promise
|
||||
/**
|
||||
* Query the EAS BuildInfo from given buildId.
|
||||
*/
|
||||
export async function queryEasBuildInfoAsync(
|
||||
cwd: string,
|
||||
buildId: string
|
||||
): Promise<BuildInfo | null> {
|
||||
export async function queryEasBuildInfoAsync(cwd: string, buildId: string): Promise<BuildInfo | null> {
|
||||
try {
|
||||
const { stdout } = await getExecOutput(
|
||||
await which('eas', true),
|
||||
['build:view', buildId, '--json'],
|
||||
{
|
||||
cwd,
|
||||
silent: true,
|
||||
}
|
||||
);
|
||||
const { stdout } = await getExecOutput(await which('eas', true), ['build:view', buildId, '--json'], {
|
||||
cwd,
|
||||
silent: true,
|
||||
});
|
||||
return JSON.parse(stdout);
|
||||
} catch (error: unknown) {
|
||||
info(`Failed to query eas build ${buildId}: ${String(error)}`);
|
||||
@@ -230,14 +208,10 @@ export async function projectInfo(dir: string): Promise<ProjectInfo> {
|
||||
let stdout = '';
|
||||
|
||||
try {
|
||||
({ stdout } = await getExecOutput(
|
||||
await which('expo', true),
|
||||
['config', '--json', '--type', 'prebuild'],
|
||||
{
|
||||
cwd: dir,
|
||||
silent: true,
|
||||
}
|
||||
));
|
||||
({ stdout } = await getExecOutput(await which('expo', true), ['config', '--json', '--type', 'prebuild'], {
|
||||
cwd: dir,
|
||||
silent: true,
|
||||
}));
|
||||
} catch (error: unknown) {
|
||||
throw new Error(`Could not fetch the project info from ${dir}`, { cause: error });
|
||||
}
|
||||
@@ -262,10 +236,7 @@ export function projectAppType(dir: string): 'expo-go' | 'dev-build' {
|
||||
throw new Error(`Could not load the project package file in: ${packageFile}`, { cause: error });
|
||||
}
|
||||
|
||||
if (
|
||||
packageJson?.dependencies?.['expo-dev-client'] ||
|
||||
packageJson?.devDependencies?.['expo-dev-client']
|
||||
) {
|
||||
if (packageJson?.dependencies?.['expo-dev-client'] || packageJson?.devDependencies?.['expo-dev-client']) {
|
||||
return 'dev-build';
|
||||
}
|
||||
|
||||
@@ -317,9 +288,13 @@ export function projectDeepLink(project: ProjectInfo, channel?: string): string
|
||||
}
|
||||
|
||||
export function getBuildLogsUrl(build: BuildInfo): string {
|
||||
// TODO: reuse this function from the original source
|
||||
// see: https://github.com/expo/eas-cli/blob/896f7f038582347c57dc700be9ea7d092b5a3a21/packages/eas-cli/src/build/utils/url.ts#L13-L21
|
||||
const { project } = build;
|
||||
const path = `/accounts/${project.ownerAccount.name}/projects/${project.slug}/builds/${build.id}`;
|
||||
const baseUrl = process.env.EXPO_STAGING ? 'staging.expo.dev' : 'expo.dev';
|
||||
const url = new URL(path, `https://${baseUrl}`);
|
||||
const path = project
|
||||
? `/accounts/${project.ownerAccount.name}/projects/${project.slug}/builds/${build.id}`
|
||||
: `/builds/${build.id}`;
|
||||
|
||||
const url = new URL(path, 'https://expo.dev');
|
||||
return url.toString();
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { FingerprintSource, Fingerprint as FingerprintType } from '@expo/fingerprint';
|
||||
import type { Fingerprint as FingerprintType, FingerprintSource } from '@expo/fingerprint';
|
||||
|
||||
import { Database, openDatabaseAsync } from '../sqlite';
|
||||
import { openDatabaseAsync, Database } from '../sqlite';
|
||||
|
||||
export type FingerprintDbEntity = Camelize<RawFingerprintDbEntity> & {
|
||||
fingerprint: FingerprintType;
|
||||
@@ -12,9 +12,7 @@ export class FingerprintDbManager {
|
||||
public async initAsync(): Promise<Database> {
|
||||
const db = await openDatabaseAsync(this.dbPath);
|
||||
await db.runAsync(
|
||||
`CREATE TABLE IF NOT EXISTS ${
|
||||
FingerprintDbManager.TABLE_NAME
|
||||
} (${FingerprintDbManager.SCHEMA.join(', ')})`
|
||||
`CREATE TABLE IF NOT EXISTS ${FingerprintDbManager.TABLE_NAME} (${FingerprintDbManager.SCHEMA.join(', ')})`
|
||||
);
|
||||
for (const index of FingerprintDbManager.INDEXES) {
|
||||
await db.runAsync(index);
|
||||
@@ -66,9 +64,7 @@ export class FingerprintDbManager {
|
||||
/**
|
||||
* Get the latest entity from the fingerprint hash where the eas_build_id is not null.
|
||||
*/
|
||||
public async getLatestEasEntityFromFingerprintAsync(
|
||||
fingerprintHash: string
|
||||
): Promise<FingerprintDbEntity | null> {
|
||||
public async getLatestEasEntityFromFingerprintAsync(fingerprintHash: string): Promise<FingerprintDbEntity | null> {
|
||||
if (!this.db) {
|
||||
throw new Error('Database not initialized. Call initAsync() first.');
|
||||
}
|
||||
@@ -81,9 +77,7 @@ export class FingerprintDbManager {
|
||||
return row ? FingerprintDbManager.serialize(row) : null;
|
||||
}
|
||||
|
||||
public async getEntityFromGitCommitHashAsync(
|
||||
gitCommitHash: string
|
||||
): Promise<FingerprintDbEntity | null> {
|
||||
public async getEntityFromGitCommitHashAsync(gitCommitHash: string): Promise<FingerprintDbEntity | null> {
|
||||
if (!this.db) {
|
||||
throw new Error('Database not initialized. Call initAsync() first.');
|
||||
}
|
||||
@@ -94,9 +88,7 @@ export class FingerprintDbManager {
|
||||
return row ? FingerprintDbManager.serialize(row) : null;
|
||||
}
|
||||
|
||||
public async getFirstEntityFromFingerprintHashAsync(
|
||||
fingerprintHash: string
|
||||
): Promise<FingerprintDbEntity | null> {
|
||||
public async getFirstEntityFromFingerprintHashAsync(fingerprintHash: string): Promise<FingerprintDbEntity | null> {
|
||||
if (!this.db) {
|
||||
throw new Error('Database not initialized. Call initAsync() first.');
|
||||
}
|
||||
@@ -107,9 +99,7 @@ export class FingerprintDbManager {
|
||||
return row ? FingerprintDbManager.serialize(row) : null;
|
||||
}
|
||||
|
||||
public async queryEntitiesFromFingerprintHashAsync(
|
||||
fingerprintHash: string
|
||||
): Promise<FingerprintDbEntity[]> {
|
||||
public async queryEntitiesFromFingerprintHashAsync(fingerprintHash: string): Promise<FingerprintDbEntity[]> {
|
||||
if (!this.db) {
|
||||
throw new Error('Database not initialized. Call initAsync() first.');
|
||||
}
|
||||
@@ -120,9 +110,7 @@ export class FingerprintDbManager {
|
||||
return rows.map(row => FingerprintDbManager.serialize(row));
|
||||
}
|
||||
|
||||
public async getFingerprintSourcesAsync(
|
||||
fingerprintHash: string
|
||||
): Promise<FingerprintSource[] | null> {
|
||||
public async getFingerprintSourcesAsync(fingerprintHash: string): Promise<FingerprintSource[] | null> {
|
||||
if (!this.db) {
|
||||
throw new Error('Database not initialized. Call initAsync() first.');
|
||||
}
|
||||
|
||||
@@ -27,19 +27,13 @@ export async function createFingerprintOutputAsync(
|
||||
dbManager: FingerprintDbManager,
|
||||
input: ReturnType<typeof collectFingerprintActionInput>
|
||||
): Promise<FingerprintOutput> {
|
||||
await installFingerprintAsync(
|
||||
input.fingerprintVersion,
|
||||
input.packager,
|
||||
input.fingerprintInstallationCache
|
||||
);
|
||||
await installFingerprintAsync(input.fingerprintVersion, input.packager, input.fingerprintInstallationCache);
|
||||
const fingerprint = require('@expo/fingerprint') as typeof import('@expo/fingerprint');
|
||||
const currentFingerprint = await fingerprint.createFingerprintAsync(input.workingDirectory);
|
||||
|
||||
let previousFingerprint: FingerprintDbEntity | null = null;
|
||||
if (input.previousGitCommitHash) {
|
||||
previousFingerprint = await dbManager.getEntityFromGitCommitHashAsync(
|
||||
input.previousGitCommitHash
|
||||
);
|
||||
previousFingerprint = await dbManager.getEntityFromGitCommitHashAsync(input.previousGitCommitHash);
|
||||
}
|
||||
|
||||
const diff =
|
||||
@@ -67,9 +61,7 @@ export async function createFingerprintDbManagerAsync(
|
||||
if (cacheHit) {
|
||||
info(`Restored fingerprint database from cache - cacheKey[${cacheKey}]`);
|
||||
} else {
|
||||
info(
|
||||
`Missing fingerprint database from cache - will create a new database - cacheKey[${cacheKey}]`
|
||||
);
|
||||
info(`Missing fingerprint database from cache - will create a new database - cacheKey[${cacheKey}]`);
|
||||
}
|
||||
const dbManager = new FingerprintDbManager(dbPath);
|
||||
await dbManager.initAsync();
|
||||
@@ -86,8 +78,7 @@ export function collectFingerprintActionInput() {
|
||||
workingDirectory: getInput('working-directory'),
|
||||
fingerprintVersion: getInput('fingerprint-version') || 'latest',
|
||||
fingerprintInstallationCache:
|
||||
!getInput('fingerprint-installation-cache') ||
|
||||
getBooleanInput('fingerprint-installation-cache'),
|
||||
!getInput('fingerprint-installation-cache') || getBooleanInput('fingerprint-installation-cache'),
|
||||
fingerprintDbCacheKey: getInput('fingerprint-db-cache-key'),
|
||||
previousGitCommitHash:
|
||||
getInput('previous-git-commit') ||
|
||||
@@ -96,9 +87,7 @@ export function collectFingerprintActionInput() {
|
||||
: githubContext.payload.before),
|
||||
currentGitCommitHash:
|
||||
getInput('current-git-commit') ||
|
||||
(githubContext.eventName === 'pull_request'
|
||||
? githubContext.payload.pull_request?.head?.sha
|
||||
: githubContext.sha),
|
||||
(githubContext.eventName === 'pull_request' ? githubContext.payload.pull_request?.head?.sha : githubContext.sha),
|
||||
savingDbBranch: getInput('saving-db-branch') || undefined,
|
||||
};
|
||||
}
|
||||
@@ -156,15 +145,8 @@ export async function saveDbToCacheAsync(cacheKey: string) {
|
||||
* Get the path to the fingerprint database
|
||||
*/
|
||||
async function getDbPathAsync(): Promise<string> {
|
||||
assert(
|
||||
process.env['RUNNER_TOOL_CACHE'],
|
||||
'Could not resolve the local tool cache, RUNNER_TOOL_CACHE not defined'
|
||||
);
|
||||
const result = path.join(
|
||||
process.env['RUNNER_TOOL_CACHE'],
|
||||
'fingerprint-storage',
|
||||
'fingerprint.db'
|
||||
);
|
||||
assert(process.env['RUNNER_TOOL_CACHE'], 'Could not resolve the local tool cache, RUNNER_TOOL_CACHE not defined');
|
||||
const result = path.join(process.env['RUNNER_TOOL_CACHE'], 'fingerprint-storage', 'fingerprint.db');
|
||||
const dir = path.dirname(result);
|
||||
if (!(await fs.promises.stat(dir).catch(() => null))) {
|
||||
await mkdirP(dir);
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
import { info, isDebug } from '@actions/core';
|
||||
import { getExecOutput } from '@actions/exec';
|
||||
import { which } from '@actions/io';
|
||||
|
||||
import { BuildInfo, BuildStatus } from './expo';
|
||||
|
||||
export async function getBuildInfoForCurrentFingerprintAsync({
|
||||
platform,
|
||||
workingDirectory,
|
||||
environment,
|
||||
profile,
|
||||
isInPullRequest,
|
||||
}: {
|
||||
platform: 'ios' | 'android';
|
||||
profile: string;
|
||||
workingDirectory: string;
|
||||
environment: string | null;
|
||||
isInPullRequest: boolean;
|
||||
}): Promise<{ buildInfo: BuildInfo | null; fingerprintHash: string }> {
|
||||
const humanReadablePlatformName = platform === 'ios' ? 'iOS' : 'Android';
|
||||
|
||||
const fingerprintHash = await getFingerprintHashForPlatformAsync({
|
||||
cwd: workingDirectory,
|
||||
platform,
|
||||
environment,
|
||||
});
|
||||
|
||||
info(`${humanReadablePlatformName} fingerprint: ${fingerprintHash}`);
|
||||
|
||||
info(
|
||||
`Looking for ${humanReadablePlatformName} builds with matching runtime version (fingerprint)...`
|
||||
);
|
||||
|
||||
return {
|
||||
buildInfo: await getBuildInfoWithFingerprintAsync({
|
||||
cwd: workingDirectory,
|
||||
platform,
|
||||
profile,
|
||||
fingerprintHash,
|
||||
excludeExpiredBuilds: isInPullRequest,
|
||||
}),
|
||||
fingerprintHash,
|
||||
};
|
||||
}
|
||||
|
||||
async function getFingerprintHashForPlatformAsync({
|
||||
cwd,
|
||||
platform,
|
||||
environment,
|
||||
}: {
|
||||
cwd: string;
|
||||
platform: 'ios' | 'android';
|
||||
environment: string | null;
|
||||
}): Promise<string> {
|
||||
let hash: string;
|
||||
try {
|
||||
const extraArgs = isDebug() ? ['--debug'] : [];
|
||||
|
||||
const baseArguments = [
|
||||
'expo-updates',
|
||||
'fingerprint:generate',
|
||||
'--platform',
|
||||
platform,
|
||||
...extraArgs,
|
||||
];
|
||||
|
||||
let commandLine: string;
|
||||
let args: string[];
|
||||
if (environment) {
|
||||
commandLine = await which('eas', true);
|
||||
const commandToExecute = ['npx', ...baseArguments].join(' ').replace(/"/g, '\\"');
|
||||
args = ['env:exec', '--non-interactive', environment, `"${commandToExecute}"`];
|
||||
} else {
|
||||
commandLine = 'npx';
|
||||
args = baseArguments;
|
||||
}
|
||||
|
||||
const { stdout } = await getExecOutput(commandLine, args, {
|
||||
cwd,
|
||||
silent: !isDebug(),
|
||||
});
|
||||
hash = JSON.parse(stdout);
|
||||
} catch (error: unknown) {
|
||||
throw new Error(`Error calculating fingerprint: ${String(error)}`, { cause: error });
|
||||
}
|
||||
if (!hash || typeof hash !== 'string') {
|
||||
throw new Error(`Invalid fingerprint hash: ${hash}`);
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
export async function getBuildInfoWithFingerprintAsync({
|
||||
cwd,
|
||||
platform,
|
||||
profile,
|
||||
fingerprintHash,
|
||||
excludeExpiredBuilds,
|
||||
}: {
|
||||
cwd: string;
|
||||
platform: 'ios' | 'android';
|
||||
profile: string;
|
||||
fingerprintHash: string;
|
||||
excludeExpiredBuilds: boolean;
|
||||
}): Promise<BuildInfo | null> {
|
||||
let builds: BuildInfo[];
|
||||
try {
|
||||
const { stdout } = await getExecOutput(
|
||||
await which('eas', true),
|
||||
[
|
||||
'build:list',
|
||||
'--platform',
|
||||
platform,
|
||||
'--buildProfile',
|
||||
profile,
|
||||
'--runtimeVersion',
|
||||
fingerprintHash,
|
||||
'--limit',
|
||||
'1',
|
||||
'--json',
|
||||
'--non-interactive',
|
||||
],
|
||||
{
|
||||
cwd,
|
||||
silent: !isDebug(),
|
||||
}
|
||||
);
|
||||
builds = JSON.parse(stdout).builds;
|
||||
} catch (error: unknown) {
|
||||
throw new Error(`Error getting EAS builds: ${String(error)}`, { cause: error });
|
||||
}
|
||||
|
||||
if (!builds || !Array.isArray(builds)) {
|
||||
throw new Error(`Could not get EAS builds for project`);
|
||||
}
|
||||
|
||||
const tomorrow = new Date();
|
||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
|
||||
const buildsThatAreValid = (builds as BuildInfo[]).filter(build => {
|
||||
const isValidStatus = [
|
||||
BuildStatus.New,
|
||||
BuildStatus.InQueue,
|
||||
BuildStatus.InProgress,
|
||||
BuildStatus.Finished,
|
||||
].includes(build.status);
|
||||
// if the build is expired or will expire within the next day,
|
||||
const isValidExpiry = excludeExpiredBuilds ? new Date(build.expirationDate) > tomorrow : true;
|
||||
return isValidStatus && isValidExpiry;
|
||||
});
|
||||
|
||||
return buildsThatAreValid[0] ?? null;
|
||||
}
|
||||
+4
-13
@@ -1,4 +1,4 @@
|
||||
import { context, getOctokit } from '@actions/github';
|
||||
import { getOctokit, context } from '@actions/github';
|
||||
import { ok as assert } from 'assert';
|
||||
|
||||
type IssueContext = (typeof context)['issue'];
|
||||
@@ -77,10 +77,7 @@ export async function createIssueComment(options: AuthContext & IssueContext & C
|
||||
*/
|
||||
export function githubApi(options: AuthContext = {}): ReturnType<typeof getOctokit> {
|
||||
const token = process.env['GITHUB_TOKEN'] || options.token;
|
||||
assert(
|
||||
token,
|
||||
`This step requires 'github-token' or a GITHUB_TOKEN environment variable to create comments`
|
||||
);
|
||||
assert(token, `This step requires 'github-token' or a GITHUB_TOKEN environment variable to create comments`);
|
||||
return getOctokit(token);
|
||||
}
|
||||
|
||||
@@ -148,10 +145,7 @@ export function issueComment() {
|
||||
/**
|
||||
* Get the commit message for a specific commit hash.
|
||||
*/
|
||||
export async function getGitCommandMessageAsync(
|
||||
options: AuthContext,
|
||||
gitCommitHash: string
|
||||
): Promise<string> {
|
||||
export async function getGitCommandMessageAsync(options: AuthContext, gitCommitHash: string): Promise<string> {
|
||||
const github = githubApi({ token: options.token });
|
||||
const result = await github.rest.git.getCommit({
|
||||
...context.repo,
|
||||
@@ -179,10 +173,7 @@ export function isPushBranchContext(targetBranch: string) {
|
||||
/**
|
||||
* Get the pull request information that associated with a specific commit hash.
|
||||
*/
|
||||
export async function getPullRequestFromGitCommitShaAsync(
|
||||
options: AuthContext,
|
||||
gitCommitHash: string
|
||||
) {
|
||||
export async function getPullRequestFromGitCommitShaAsync(options: AuthContext, gitCommitHash: string) {
|
||||
const github = githubApi({ token: options.token });
|
||||
const results = await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
||||
...context.repo,
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import { InputOptions, getInput as getActionInput } from '@actions/core';
|
||||
|
||||
export function getInput(name: string, options: { required: true }): string;
|
||||
export function getInput(name: string): string | null;
|
||||
export function getInput(name: string, options?: InputOptions): string | null {
|
||||
const value = getActionInput(name, options);
|
||||
if (!value) {
|
||||
if (options?.required) {
|
||||
throw new Error(`Input ${name} is required.`);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
+1
-3
@@ -12,9 +12,7 @@ export async function resolvePackage(name: string, range: string): Promise<strin
|
||||
let stdout = '';
|
||||
|
||||
try {
|
||||
({ stdout } = await getExecOutput('npm', ['info', `${name}@${range}`, 'version', '--json'], {
|
||||
silent: true,
|
||||
}));
|
||||
({ stdout } = await getExecOutput('npm', ['info', `${name}@${range}`, 'version', '--json'], { silent: true }));
|
||||
} catch (error: unknown) {
|
||||
throw new Error(`Could not resolve ${name}@${range}`, { cause: error });
|
||||
}
|
||||
|
||||
+3
-21
@@ -1,6 +1,4 @@
|
||||
import { isDebug } from '@actions/core';
|
||||
import { getExecOutput } from '@actions/exec';
|
||||
import { which } from '@actions/io';
|
||||
import { ExpoConfig } from '@expo/config';
|
||||
|
||||
/**
|
||||
@@ -8,29 +6,13 @@ import { ExpoConfig } from '@expo/config';
|
||||
* This runs `expo config` command instead of using `@expo/config` directly,
|
||||
* to use the app's own version of the config.
|
||||
*/
|
||||
export async function loadProjectConfig(
|
||||
cwd: string,
|
||||
easEnvironment: string | null
|
||||
): Promise<ExpoConfig> {
|
||||
export async function loadProjectConfig(cwd: string): Promise<ExpoConfig> {
|
||||
let stdout = '';
|
||||
|
||||
const baseArguments = ['expo', 'config', '--json', '--type', 'public'];
|
||||
|
||||
let commandLine: string;
|
||||
let args: string[];
|
||||
if (easEnvironment) {
|
||||
commandLine = await which('eas', true);
|
||||
const commandToExecute = ['npx', ...baseArguments].join(' ').replace(/"/g, '\\"');
|
||||
args = ['env:exec', '--non-interactive', easEnvironment, `"${commandToExecute}"`];
|
||||
} else {
|
||||
commandLine = 'npx';
|
||||
args = baseArguments;
|
||||
}
|
||||
|
||||
try {
|
||||
({ stdout } = await getExecOutput(commandLine, args, {
|
||||
({ stdout } = await getExecOutput('npx', ['expo', 'config', '--json', '--type', 'public'], {
|
||||
cwd,
|
||||
silent: !isDebug(),
|
||||
silent: true,
|
||||
}));
|
||||
} catch (error: unknown) {
|
||||
throw new Error(`Could not fetch the project info from ${cwd}`, { cause: error });
|
||||
|
||||
+3
-10
@@ -52,12 +52,8 @@ export async function patchWatchers(): Promise<void> {
|
||||
await exec('sudo sysctl -p');
|
||||
info('Patched system watchers for the `ENOSPC` error.');
|
||||
} catch (error) {
|
||||
warning(
|
||||
`Looks like we can't patch watchers/inotify limits, you might encouter the 'ENOSPC' error.`
|
||||
);
|
||||
warning(
|
||||
'For more info: https://github.com/expo/expo-github-action/issues/20, encountered error:'
|
||||
);
|
||||
warning(`Looks like we can't patch watchers/inotify limits, you might encouter the 'ENOSPC' error.`);
|
||||
warning('For more info: https://github.com/expo/expo-github-action/issues/20, encountered error:');
|
||||
warning(String(error));
|
||||
}
|
||||
}
|
||||
@@ -73,10 +69,7 @@ export function tempPath(name: string, version: string): string {
|
||||
* @see https://github.com/actions/toolkit/blob/daf8bb00606d37ee2431d9b1596b88513dcf9c59/packages/tool-cache/src/tool-cache.ts#L747-L749
|
||||
*/
|
||||
export function toolPath(name: string, version: string): string {
|
||||
assert(
|
||||
process.env['RUNNER_TOOL_CACHE'],
|
||||
'Could not resolve the local tool cache, RUNNER_TOOL_CACHE not defined'
|
||||
);
|
||||
assert(process.env['RUNNER_TOOL_CACHE'], 'Could not resolve the local tool cache, RUNNER_TOOL_CACHE not defined');
|
||||
return path.join(process.env['RUNNER_TOOL_CACHE'], name, version, os.arch());
|
||||
}
|
||||
|
||||
|
||||
+9
-21
@@ -1,19 +1,14 @@
|
||||
import * as core from '@actions/core';
|
||||
|
||||
import {
|
||||
DEFAULT_ID,
|
||||
DEFAULT_MESSAGE,
|
||||
commentAction,
|
||||
commentInput,
|
||||
} from '../../actions/preview-comment';
|
||||
import * as expo from '../../expo';
|
||||
import * as github from '../../github';
|
||||
import { commentInput, commentAction, DEFAULT_ID, DEFAULT_MESSAGE } from '../../src/actions/preview-comment';
|
||||
import * as expo from '../../src/expo';
|
||||
import * as github from '../../src/github';
|
||||
import { mockInput } from '../utils';
|
||||
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('../../expo');
|
||||
jest.mock('../../github');
|
||||
jest.mock('../../worker');
|
||||
jest.mock('../../src/expo');
|
||||
jest.mock('../../src/github');
|
||||
jest.mock('../../src/worker');
|
||||
|
||||
describe(commentInput, () => {
|
||||
it('returns object with correct defaults', () => {
|
||||
@@ -81,9 +76,7 @@ describe(commentAction, () => {
|
||||
});
|
||||
|
||||
it('resolves project owner info by manifest owner', async () => {
|
||||
jest
|
||||
.mocked(expo.projectInfo)
|
||||
.mockResolvedValue({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' });
|
||||
jest.mocked(expo.projectInfo).mockResolvedValue({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' });
|
||||
await commentAction({ ...input });
|
||||
expect(core.setOutput).toBeCalledWith('projectOwner', 'fakeowner');
|
||||
expect(expo.projectOwner).not.toBeCalled();
|
||||
@@ -129,14 +122,9 @@ describe(commentAction, () => {
|
||||
});
|
||||
|
||||
it('sets projectQR', async () => {
|
||||
jest
|
||||
.mocked(expo.projectQR)
|
||||
.mockReturnValue('https://qr.expo.dev/expo-go?owner=fakeuser&slug=fakeslug');
|
||||
jest.mocked(expo.projectQR).mockReturnValue('https://qr.expo.dev/expo-go?owner=fakeuser&slug=fakeslug');
|
||||
await commentAction({ ...input });
|
||||
expect(core.setOutput).toBeCalledWith(
|
||||
'projectQR',
|
||||
'https://qr.expo.dev/expo-go?owner=fakeuser&slug=fakeslug'
|
||||
);
|
||||
expect(core.setOutput).toBeCalledWith('projectQR', 'https://qr.expo.dev/expo-go?owner=fakeuser&slug=fakeslug');
|
||||
});
|
||||
|
||||
it('sets message', async () => {
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ExpoConfig } from '@expo/config';
|
||||
|
||||
import { createSummary, getVariables, previewInput } from '../../actions/preview';
|
||||
import { EasUpdate } from '../../eas';
|
||||
import { createSummary, getVariables, previewInput } from '../../src/actions/preview';
|
||||
import { EasUpdate } from '../../src/eas';
|
||||
|
||||
jest.mock('../../expo');
|
||||
jest.mock('../../src/expo');
|
||||
|
||||
const fakeOptions = {
|
||||
qrTarget: 'dev-client',
|
||||
@@ -41,20 +41,13 @@ const fakeUpdatesSingle: EasUpdate[] = [
|
||||
},
|
||||
];
|
||||
|
||||
const fakeUpdatesMultiple = fakeUpdatesSingle.map(update => ({
|
||||
...update,
|
||||
group: `fake-group-${update.id}`,
|
||||
}));
|
||||
const fakeUpdatesMultiple = fakeUpdatesSingle.map(update => ({ ...update, group: `fake-group-${update.id}` }));
|
||||
|
||||
describe(createSummary, () => {
|
||||
describe('single update group', () => {
|
||||
it('returns expected message for both platforms', () => {
|
||||
expect(
|
||||
createSummary(
|
||||
fakeUpdatesSingle,
|
||||
getVariables(fakeExpoConfig, fakeUpdatesSingle, fakeOptions)
|
||||
)
|
||||
).toMatchInlineSnapshot(`
|
||||
expect(createSummary(fakeUpdatesSingle, getVariables(fakeExpoConfig, fakeUpdatesSingle, fakeOptions)))
|
||||
.toMatchInlineSnapshot(`
|
||||
"🚀 Expo preview is ready!
|
||||
|
||||
- Project → **fake-project**
|
||||
@@ -70,12 +63,8 @@ describe(createSummary, () => {
|
||||
|
||||
it('returns expected message for both platforms with custom app scheme', () => {
|
||||
const customSchemeConfig = { ...fakeExpoConfig, scheme: ['ega', 'expogithubaction'] };
|
||||
expect(
|
||||
createSummary(
|
||||
fakeUpdatesSingle,
|
||||
getVariables(customSchemeConfig, fakeUpdatesSingle, fakeOptions)
|
||||
)
|
||||
).toMatchInlineSnapshot(`
|
||||
expect(createSummary(fakeUpdatesSingle, getVariables(customSchemeConfig, fakeUpdatesSingle, fakeOptions)))
|
||||
.toMatchInlineSnapshot(`
|
||||
"🚀 Expo preview is ready!
|
||||
|
||||
- Project → **fake-project**
|
||||
@@ -92,8 +81,7 @@ describe(createSummary, () => {
|
||||
|
||||
it('returns expected message for android only', () => {
|
||||
const fakeUpdate = fakeUpdatesSingle.filter(update => update.platform === 'android');
|
||||
expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions)))
|
||||
.toMatchInlineSnapshot(`
|
||||
expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions))).toMatchInlineSnapshot(`
|
||||
"🚀 Expo preview is ready!
|
||||
|
||||
- Project → **fake-project**
|
||||
@@ -109,8 +97,7 @@ describe(createSummary, () => {
|
||||
|
||||
it('returns expected message for ios only', () => {
|
||||
const fakeUpdate = fakeUpdatesSingle.filter(update => update.platform === 'ios');
|
||||
expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions)))
|
||||
.toMatchInlineSnapshot(`
|
||||
expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions))).toMatchInlineSnapshot(`
|
||||
"🚀 Expo preview is ready!
|
||||
|
||||
- Project → **fake-project**
|
||||
@@ -127,12 +114,8 @@ describe(createSummary, () => {
|
||||
|
||||
describe('mutliple update groups', () => {
|
||||
it('returns expected message for both platforms', () => {
|
||||
expect(
|
||||
createSummary(
|
||||
fakeUpdatesMultiple,
|
||||
getVariables(fakeExpoConfig, fakeUpdatesMultiple, fakeOptions)
|
||||
)
|
||||
).toMatchInlineSnapshot(`
|
||||
expect(createSummary(fakeUpdatesMultiple, getVariables(fakeExpoConfig, fakeUpdatesMultiple, fakeOptions)))
|
||||
.toMatchInlineSnapshot(`
|
||||
"🚀 Expo preview is ready!
|
||||
|
||||
- Project → **fake-project**
|
||||
@@ -148,8 +131,7 @@ describe(createSummary, () => {
|
||||
|
||||
it('returns expected message for android only', () => {
|
||||
const fakeUpdate = fakeUpdatesSingle.filter(update => update.platform === 'android');
|
||||
expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions)))
|
||||
.toMatchInlineSnapshot(`
|
||||
expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions))).toMatchInlineSnapshot(`
|
||||
"🚀 Expo preview is ready!
|
||||
|
||||
- Project → **fake-project**
|
||||
@@ -165,8 +147,7 @@ describe(createSummary, () => {
|
||||
|
||||
it('returns expected message for ios only', () => {
|
||||
const fakeUpdate = fakeUpdatesSingle.filter(update => update.platform === 'ios');
|
||||
expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions)))
|
||||
.toMatchInlineSnapshot(`
|
||||
expect(createSummary(fakeUpdate, getVariables(fakeExpoConfig, fakeUpdate, fakeOptions))).toMatchInlineSnapshot(`
|
||||
"🚀 Expo preview is ready!
|
||||
|
||||
- Project → **fake-project**
|
||||
@@ -182,12 +163,8 @@ describe(createSummary, () => {
|
||||
|
||||
it('returns Expo Go compatible QR code when forced', () => {
|
||||
const customOptions: typeof fakeOptions = { ...fakeOptions, qrTarget: 'expo-go' };
|
||||
expect(
|
||||
createSummary(
|
||||
fakeUpdatesMultiple,
|
||||
getVariables(fakeExpoConfig, fakeUpdatesMultiple, customOptions)
|
||||
)
|
||||
).toMatchInlineSnapshot(`
|
||||
expect(createSummary(fakeUpdatesMultiple, getVariables(fakeExpoConfig, fakeUpdatesMultiple, customOptions)))
|
||||
.toMatchInlineSnapshot(`
|
||||
"🚀 Expo preview is ready!
|
||||
|
||||
- Project → **fake-project**
|
||||
@@ -1,17 +1,17 @@
|
||||
import * as core from '@actions/core';
|
||||
|
||||
import { setupAction, setupInput } from '../../actions/setup';
|
||||
import * as cacher from '../../cacher';
|
||||
import * as expo from '../../expo';
|
||||
import * as packager from '../../packager';
|
||||
import * as worker from '../../worker';
|
||||
import { setupInput, setupAction } from '../../src/actions/setup';
|
||||
import * as cacher from '../../src/cacher';
|
||||
import * as expo from '../../src/expo';
|
||||
import * as packager from '../../src/packager';
|
||||
import * as worker from '../../src/worker';
|
||||
import { mockInput } from '../utils';
|
||||
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('../../cacher');
|
||||
jest.mock('../../expo');
|
||||
jest.mock('../../packager');
|
||||
jest.mock('../../worker');
|
||||
jest.mock('../../src/cacher');
|
||||
jest.mock('../../src/expo');
|
||||
jest.mock('../../src/packager');
|
||||
jest.mock('../../src/worker');
|
||||
|
||||
describe(setupInput, () => {
|
||||
it('returns object with correct defaults', () => {
|
||||
@@ -89,12 +89,7 @@ describe(setupAction, () => {
|
||||
});
|
||||
|
||||
it('authenticates token with eas-cli by default', async () => {
|
||||
await setupAction({
|
||||
...input,
|
||||
expoVersion: 'latest',
|
||||
easVersion: 'latest',
|
||||
token: 'faketoken',
|
||||
});
|
||||
await setupAction({ ...input, expoVersion: 'latest', easVersion: 'latest', token: 'faketoken' });
|
||||
expect(expo.authenticate).toBeCalledWith('faketoken', 'eas');
|
||||
});
|
||||
|
||||
@@ -2,8 +2,8 @@ import * as cache from '@actions/cache';
|
||||
import os from 'os';
|
||||
|
||||
import { resetEnv, setEnv } from './utils';
|
||||
import { cacheKey, restoreFromCache, saveToCache } from '../cacher';
|
||||
import { toolPath } from '../worker';
|
||||
import { cacheKey, restoreFromCache, saveToCache } from '../src/cacher';
|
||||
import { toolPath } from '../src/worker';
|
||||
|
||||
jest.mock('@actions/cache');
|
||||
jest.mock('@actions/core');
|
||||
@@ -40,17 +40,13 @@ describe(restoreFromCache, () => {
|
||||
it('throws when cache has unexpected error', async () => {
|
||||
jest.mocked(cache.isFeatureAvailable).mockReturnValue(true);
|
||||
jest.mocked(cache.restoreCache).mockRejectedValue(new Error('Node registry is down'));
|
||||
await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).rejects.toThrow(
|
||||
'Node registry is down'
|
||||
);
|
||||
await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).rejects.toThrow('Node registry is down');
|
||||
});
|
||||
|
||||
it('returns expo-cli path from cache when available', async () => {
|
||||
jest.mocked(cache.isFeatureAvailable).mockReturnValue(true);
|
||||
jest.mocked(cache.restoreCache).mockResolvedValue('fake/path');
|
||||
await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).resolves.toBe(
|
||||
toolPath('expo-cli', '5.0.3')
|
||||
);
|
||||
await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).resolves.toBe(toolPath('expo-cli', '5.0.3'));
|
||||
});
|
||||
|
||||
it('returns nothing when cache is empty', async () => {
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ExpoConfig } from '@expo/config';
|
||||
|
||||
import { getQrTarget, getSchemesInOrderFromConfig } from '../comment';
|
||||
import { projectAppType } from '../expo';
|
||||
import { getQrTarget, getSchemesInOrderFromConfig } from '../src/comment';
|
||||
import { projectAppType } from '../src/expo';
|
||||
|
||||
jest.mock('../expo');
|
||||
jest.mock('../src/expo');
|
||||
|
||||
const fakeOptions = {
|
||||
workingDirectory: '',
|
||||
@@ -49,8 +49,9 @@ describe(getSchemesInOrderFromConfig, () => {
|
||||
});
|
||||
|
||||
it('returns schemes in order when defined as array', () => {
|
||||
expect(
|
||||
getSchemesInOrderFromConfig({ scheme: ['ega', 'expogithubaction'] } as ExpoConfig)
|
||||
).toEqual(['expogithubaction', 'ega']);
|
||||
expect(getSchemesInOrderFromConfig({ scheme: ['ega', 'expogithubaction'] } as ExpoConfig)).toEqual([
|
||||
'expogithubaction',
|
||||
'ega',
|
||||
]);
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getUpdateGroupQr } from '../eas';
|
||||
import { getUpdateGroupQr } from '../src/eas';
|
||||
|
||||
describe(getUpdateGroupQr, () => {
|
||||
it('returns url for expo-go', () => {
|
||||
@@ -20,9 +20,7 @@ describe(getUpdateGroupQr, () => {
|
||||
updateGroupId: 'updateGroupId',
|
||||
appSlug: 'appslug',
|
||||
})
|
||||
).toBe(
|
||||
'https://qr.expo.dev/eas-update?appScheme=appslug&projectId=projectId&groupId=updateGroupId'
|
||||
);
|
||||
).toBe('https://qr.expo.dev/eas-update?appScheme=appslug&projectId=projectId&groupId=updateGroupId');
|
||||
});
|
||||
|
||||
it('returns url for dev-build, with `_` in appSlug', () => {
|
||||
@@ -33,8 +31,6 @@ describe(getUpdateGroupQr, () => {
|
||||
updateGroupId: 'updateGroupId',
|
||||
appSlug: 'hello_world',
|
||||
})
|
||||
).toBe(
|
||||
'https://qr.expo.dev/eas-update?appScheme=helloworld&projectId=projectId&groupId=updateGroupId'
|
||||
);
|
||||
).toBe('https://qr.expo.dev/eas-update?appScheme=helloworld&projectId=projectId&groupId=updateGroupId');
|
||||
});
|
||||
});
|
||||
@@ -2,7 +2,7 @@ import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as io from '@actions/io';
|
||||
|
||||
import { authenticate, parseCommand, projectDeepLink, projectLink, projectQR } from '../expo';
|
||||
import { authenticate, projectQR, projectLink, projectDeepLink, parseCommand } from '../src/expo';
|
||||
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('@actions/exec');
|
||||
@@ -63,9 +63,9 @@ describe(projectQR, () => {
|
||||
});
|
||||
|
||||
it('returns url with owner, slug, and release channel', () => {
|
||||
expect(
|
||||
projectQR({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')
|
||||
).toBe('https://qr.expo.dev/expo-go?owner=fakeowner&slug=fakeslug&releaseChannel=fakechannel');
|
||||
expect(projectQR({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')).toBe(
|
||||
'https://qr.expo.dev/expo-go?owner=fakeowner&slug=fakeslug&releaseChannel=fakechannel'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -81,9 +81,9 @@ describe(projectLink, () => {
|
||||
});
|
||||
|
||||
it('returns url with owner, slug, and release channel', () => {
|
||||
expect(
|
||||
projectLink({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')
|
||||
).toBe('https://expo.dev/@fakeowner/fakeslug?release-channel=fakechannel');
|
||||
expect(projectLink({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')).toBe(
|
||||
'https://expo.dev/@fakeowner/fakeslug?release-channel=fakechannel'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -99,8 +99,8 @@ describe(projectDeepLink, () => {
|
||||
});
|
||||
|
||||
it('returns url with owner, slug, and release channel', () => {
|
||||
expect(
|
||||
projectDeepLink({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')
|
||||
).toBe('exp://exp.host/@fakeowner/fakeslug?release-channel=fakechannel');
|
||||
expect(projectDeepLink({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')).toBe(
|
||||
'exp://exp.host/@fakeowner/fakeslug?release-channel=fakechannel'
|
||||
);
|
||||
});
|
||||
});
|
||||
+4
-9
@@ -1,6 +1,6 @@
|
||||
import type { FingerprintSource } from '@expo/fingerprint';
|
||||
|
||||
import { FingerprintDbManager } from '../../fingerprint/FingerprintDbManager';
|
||||
import { FingerprintDbManager } from '../../src/fingerprint/FingerprintDbManager';
|
||||
|
||||
describe(FingerprintDbManager, () => {
|
||||
let fingerprintDbManager: FingerprintDbManager;
|
||||
@@ -19,12 +19,8 @@ describe(FingerprintDbManager, () => {
|
||||
easBuildId: 'id1',
|
||||
fingerprint: { sources: [], hash: 'hash1' },
|
||||
});
|
||||
expect(await fingerprintDbManager.queryEasBuildIdsFromFingerprintAsync('nonExistedId')).toEqual(
|
||||
[]
|
||||
);
|
||||
expect(await fingerprintDbManager.queryEasBuildIdsFromFingerprintAsync('hash1')).toEqual([
|
||||
'id1',
|
||||
]);
|
||||
expect(await fingerprintDbManager.queryEasBuildIdsFromFingerprintAsync('nonExistedId')).toEqual([]);
|
||||
expect(await fingerprintDbManager.queryEasBuildIdsFromFingerprintAsync('hash1')).toEqual(['id1']);
|
||||
});
|
||||
|
||||
it('getFingerprintSourcesAsync', async () => {
|
||||
@@ -44,8 +40,7 @@ describe(FingerprintDbManager, () => {
|
||||
{
|
||||
type: 'contents',
|
||||
id: 'packageJson:scripts',
|
||||
contents:
|
||||
'{"start":"expo start","android":"expo run:android","ios":"expo run:ios","web":"expo start --web"}',
|
||||
contents: '{"start":"expo start","android":"expo run:android","ios":"expo run:ios","web":"expo start --web"}',
|
||||
reasons: ['packageJson:scripts'],
|
||||
hash: '119dec73c92445762a48c9455d9f34a643be8cf0',
|
||||
},
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as github from '@actions/github';
|
||||
|
||||
import { resetEnv, setEnv } from './utils';
|
||||
import { githubApi, pullContext } from '../github';
|
||||
import { setEnv, resetEnv } from './utils';
|
||||
import { githubApi, pullContext } from '../src/github';
|
||||
|
||||
jest.mock('@actions/github');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { resolvePackage } from '../packager';
|
||||
import { resolvePackage } from '../src/packager';
|
||||
|
||||
describe(resolvePackage, () => {
|
||||
it('resolves expo-cli@^2.0.0 to 2.21.2', async () => {
|
||||
@@ -18,9 +18,9 @@ describe(resolvePackage, () => {
|
||||
});
|
||||
|
||||
it('rejects donotpublishthispackageoryouwillbefired with proper error', async () => {
|
||||
await expect(
|
||||
resolvePackage('donotpublishthispackageoryouwillbefired', 'latest')
|
||||
).rejects.toThrow('Could not resolve');
|
||||
await expect(resolvePackage('donotpublishthispackageoryouwillbefired', 'latest')).rejects.toThrow(
|
||||
'Could not resolve'
|
||||
);
|
||||
});
|
||||
|
||||
it('rejects expo-cli@9999999 with proper error', async () => {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Database, openDatabaseAsync } from '../sqlite';
|
||||
import { openDatabaseAsync, Database } from '../src/sqlite';
|
||||
|
||||
describe(openDatabaseAsync, () => {
|
||||
let db: Database;
|
||||
File renamed without changes.
@@ -3,14 +3,8 @@ import * as exec from '@actions/exec';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
import { resetEnv, resetPlatform, setEnv, setPlatform } from './utils';
|
||||
import {
|
||||
executeAction,
|
||||
installToolFromPackage,
|
||||
patchWatchers,
|
||||
tempPath,
|
||||
toolPath,
|
||||
} from '../worker';
|
||||
import { resetEnv, setEnv, setPlatform, resetPlatform } from './utils';
|
||||
import { tempPath, toolPath, installToolFromPackage, patchWatchers, executeAction } from '../src/worker';
|
||||
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('@actions/exec');
|
||||
@@ -25,9 +19,7 @@ describe(tempPath, () => {
|
||||
|
||||
it('returns path with name, version, and arch type', () => {
|
||||
setEnv('RUNNER_TEMP', 'fake/temp');
|
||||
expect(tempPath('expo-cli', '5.0.3')).toBe(
|
||||
path.join('fake', 'temp', 'expo-cli', '5.0.3', os.arch())
|
||||
);
|
||||
expect(tempPath('expo-cli', '5.0.3')).toBe(path.join('fake', 'temp', 'expo-cli', '5.0.3', os.arch()));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -41,9 +33,7 @@ describe(toolPath, () => {
|
||||
|
||||
it('returns path with name, version, and arch type', () => {
|
||||
setEnv('RUNNER_TOOL_CACHE', 'fake/tool');
|
||||
expect(toolPath('eas-cli', '0.34.3')).toBe(
|
||||
path.join('fake', 'tool', 'eas-cli', '0.34.3', os.arch())
|
||||
);
|
||||
expect(toolPath('eas-cli', '0.34.3')).toBe(path.join('fake', 'tool', 'eas-cli', '0.34.3', os.arch()));
|
||||
});
|
||||
});
|
||||
|
||||
+2
-2
@@ -1,8 +1,7 @@
|
||||
{
|
||||
"extends": "@tsconfig/node20",
|
||||
"compilerOptions": {
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src",
|
||||
"module": "CommonJS",
|
||||
"moduleResolution": "node"
|
||||
@@ -10,5 +9,6 @@
|
||||
"exclude": [
|
||||
"build",
|
||||
"node_modules",
|
||||
"tests/**"
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user