expo / expo-github-action

Expo GitHub Action makes it easy to automate EAS builds or updates
MIT License
795 stars 77 forks source link

QR codes broken when using custom schemes #240

Closed erickreutz closed 11 months ago

erickreutz commented 12 months ago

Firstly app.json defines the type of scheme as string | string[] and from what I can tell this action doesn't account for an array. https://github.com/expo/expo-github-action/blob/57dcabe749340c8c995ee0334cd7c547c35770d0/src/actions/preview.ts#L113

I've also noticed that QR codes break when using custom schemes that deviate from the default project slug. For example if the scheme in my app.json is myapp-dev and the slug is myapp and the bundleId is com.org.myapp then expo prebuild will add the following schemes to Info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    ...
    <array>
      <dict>
        <key>CFBundleURLSchemes</key>
        <array>
          <string>myapp-dev</string>
          <string>com.org.myapp</string>
        </array>
      </dict>
      <dict>
        <key>CFBundleURLSchemes</key>
        <array>
          <string>exp+myapp</string>
        </array>
      </dict>
    </array>
    ...
  </dict>
</plist>

You'll then use the custom scheme to get a QR code here

https://qr.expo.dev/eas-update?appScheme=myapp-devprojectId=123&groupId=456

This returns a QR code that the expo-dev-client will not understand because it appends exp+ to all app schemes and exp+myapp-dev is not a known scheme.

You can see an example of this problem at https://expo.dev

image

It says "use appScheme" from app.json but it's not the appScheme it's expecting - it's the project slug because the appScheme (if it's user-defined) won't work with the exp+ prefix.

byCedric commented 11 months ago

Hi @erickreutz, thanks for reporting this issue! I've just patched support for multiple app schemes, this was added lately and wasn't updated in this action yet. See PR #244 for this.

The other issue, related to the QR code prefixing schemes with exp+, work is on it's way. But, since this is part of our internal services, it's on a private repo.

Will provide an update once I have more!

byCedric commented 11 months ago

The multi-scheme fix, and an optional "overwrite" app-scheme input property are released on expo/expo-github-action/preview@v8.

The QR code with exp+ prefix will likely take a bit longer because of a US holiday.

byCedric commented 11 months ago

Fix has been merged and released as expo/expo-github-action/preview@8. Website fix is a minor textual change, which we don't need to wait for.

erickreutz commented 11 months ago

@byCedric thank you!