Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom scheme for QR codes #1

Open
wants to merge 1 commit into
base: lawrence-support-either-issue-or-pull
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions build/continuous-deploy-fingerprint/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions build/preview/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions continuous-deploy-fingerprint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ inputs:
branch:
description: The EAS Update branch on which to publish.
required: true
scheme:
description: An optional scheme to use to when generating QR codes.
github-token:
description: GitHub token to use when commenting on PR
required: false
Expand Down
7 changes: 5 additions & 2 deletions src/actions/continuous-deploy-fingerprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export function collectContinuousDeployFingerprintInput() {
return {
profile: getInput('profile'),
branch: getInput('branch'),
scheme: getInput('scheme'),
githubToken: getInput('github-token'),
workingDirectory: getInput('working-directory'),
};
Expand Down Expand Up @@ -254,7 +255,7 @@ function createSummaryForUpdatesAndBuilds({
projectId: string;
updates: EasUpdate[];
builds: BuildInfo[];
options: { qrTarget?: 'expo-go' | 'dev-build' | 'dev-client'; workingDirectory: string };
options: { qrTarget?: 'expo-go' | 'dev-build' | 'dev-client'; scheme?: string; workingDirectory: string };
}) {
const appSlug = config.slug;
const qrTarget = getQrTarget(options);
Expand All @@ -271,7 +272,9 @@ function createSummaryForUpdatesAndBuilds({
const getUpdateLink = (update: EasUpdate | undefined) =>
update ? `[Update Permalink](${getUpdateGroupWebsite({ projectId, updateGroupId: update.group })})` : 'n/a';
const getUpdateQRURL = (update: EasUpdate | undefined) =>
update ? getUpdateGroupQr({ projectId, updateGroupId: update.group, appSlug, qrTarget }) : null;
update
? getUpdateGroupQr({ projectId, updateGroupId: update.group, appSlug, scheme: options.scheme, qrTarget })
: null;
const getBuildDetails = (build: BuildInfo | undefined) =>
build
? getBuildLink(build) +
Expand Down
6 changes: 5 additions & 1 deletion src/eas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,15 @@ export function getUpdateGroupQr({
projectId,
updateGroupId,
appSlug,
scheme,
qrTarget,
}: {
projectId: string;
updateGroupId: string;
appSlug: string;
// Allow overriding the scheme so people with different app bundles can direct
// QR codes into the right bundle for the given build.
scheme?: string;
qrTarget: 'expo-go' | 'dev-build';
}): string {
const url = new URL('https://qr.expo.dev/eas-update');
Expand All @@ -85,7 +89,7 @@ export function getUpdateGroupQr({
// While the parameter is called `appScheme`, it's actually the app's slug
// This should only be added when using dev clients as target
// 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, ''));
url.searchParams.append('appScheme', scheme || appSlug.replace(/[^A-Za-z0-9+\-.]/g, ''));
}

url.searchParams.append('projectId', projectId);
Expand Down