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

EAS Update: Preview with comment #189

Closed
robertoyoc opened this issue Jul 27, 2022 · 21 comments · Fixed by #206
Closed

EAS Update: Preview with comment #189

robertoyoc opened this issue Jul 27, 2022 · 21 comments · Fixed by #206
Labels
bug Something isn't working released

Comments

@robertoyoc
Copy link

robertoyoc commented Jul 27, 2022

Description of the feature

expo/expo-github-action/preview-comment to be compatible with EAS Update.

Motivation

We have examples for EAS build in the README and it is possible to open channels/branches with the expo app but with classic release channels we are able to scan a QR code.

Additional context

      - name: Setup Expo
        uses: expo/[email protected]
        with:
          expo-version: latest
          eas-version: latest
          token: ${{ secrets.EXPO_TOKEN }}

      - name: Publish preview
        run: eas update --branch pr-${{ github.event.number }} --message 'Update with commit ${{ github.sha }}'

      - name: Comment preview
        uses: expo/expo-github-action/[email protected]
        with:
          channel: pr-${{ github.event.number }}

Comment preview will use classic release channels to generate the QR code, so when scanning the code, it won't work.

@byCedric byCedric added the bug Something isn't working label Aug 3, 2022
@gtokman
Copy link

gtokman commented Aug 9, 2022

@byCedric Is it possible to see a preview comment for EAS update?

      - name: Install dependencies
        run: yarn install --immutable

      - name: Generate Bundle
        run: expo export --experimental-bundle

      - name: Publish to Expo
        run: eas update --branch=pr-${{ github.event.number }} --non-interactive --auto

      - name: Comment in preview
        uses: expo/expo-github-action/preview-comment@v7
        with:
          channel: pr-${{ github.event.number }}

The preview step is failing at the moment

Could not fetch the project info from , reason:

Screen Shot 2022-08-09 at 10 53 06 AM

@robertoyoc
Copy link
Author

robertoyoc commented Aug 9, 2022

Got it working by doing:

      - name: Publish preview
         run: eas update --branch pr-${{ github.event.number }} --message 'Update with commit ${{ github.sha }}'
      - name: Comment preview
         uses: expo/expo-github-action/[email protected]
         with:
          message: '<h2>Your Project!</h2><h3>Channel: pr-${{ github.event.number }}</h3><a href="exp+<YOUR_SCHEME>://expo-development-client/?url=<YOUR_EXPO_UPDATES_URL>%3Fchannel-name%3Dpr-${{ github.event.number }}"><img src="https://qr.expo.dev/development-client?appScheme=exp%2B<YOUR_SCHEME>&url=<YOUR_EXPO_UPDATES_URL>%3Fchannel-name%3Dpr-${{ github.event.number }}" height="200px" width="200px"></a>'

Replace:

  • < YOUR_SCHEME >
  • < YOUR_EXPO_UPDATES_URL > with your urlEncoded expo updates url.

Also, you need an internal distribution (development) build to be able to scan the QR.

@lachenmayer
Copy link

lachenmayer commented Aug 22, 2022

We ran into this issue ourselves, we're using the following fork: main...lachenmayer:expo-github-action:eas-updates-qr

You can use this with uses: lachenmayer/expo-github-action/preview-comment@eas-updates-qr to try it out, but please don't rely on it...

This checks whether project.updates.url exists, and creates a QR code compatible with a dev client instead of the Expo Go QR code if so.

Happy to open a PR if you agree with the approach.

@matthewford
Copy link

It would be great to get this working with eas build

@kylerjensen
Copy link

kylerjensen commented Aug 30, 2022

Why are QR codes not compatible with Expo Go when using EAS Update? I get that the QR code contents might need to change for EAS Update and the scheme needs to change if we're using development clients, but my organization is just trying to migrate to EAS Update without switching to development clients yet. Updates published with EAS Update will run with no problem on binaries compiled using EAS Build with "runtimeVersion": { "policy": "sdkVersion" } and can be opened in Expo Go through the user interface, so why don't we have a QR code or deep link format that launches Expo Go with an EAS Update channel using the exp:// scheme?

This may seem like a small issue, but it's blocking my org from switching to EAS Update. We aren't ready to switch to development clients yet, so we need to keep using Expo Go and QR codes.

@bbuchalter
Copy link

It would be great to get this working with eas build

@matthewford can you say more? I'm wondering if you're hoping for the same thing I am...

I'm using internal distribution with EAS build, and I'd like the QR code that's generated to be published as a comment on the PR.

@matthewford
Copy link

matthewford commented Sep 6, 2022 via email

@danielgangverk
Copy link

I'm having the same problem, it would be nice to have these QR codes working with eas update as well

@robertoyoc
Copy link
Author

robertoyoc commented Sep 15, 2022

another option here:

jobs:
  publish:
    runs-on: ubuntu-latest
    name: Publish with release channel
    steps:
      - uses: actions/checkout@v3
      - name: Cache node modules
        uses: actions/cache@v2
        env:
          cache-name: cache-node-modules
        with:
          path: node_modules/
          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
      - name: Setup Expo
        uses: expo/[email protected]
        with:
          expo-version: latest
          eas-version: latest
          token: ${{ secrets.EXPO_TOKEN }}

      - name: Publish preview
        id: update
        run: |
          eas update --branch pr-${{ github.event.number }} --message 'Update with commit ${{ github.sha }}' --json | jq '.[].id' -r > updates.txt
          ANDROID_URL="$(sed -n 1p updates.txt)"
          IOS_URL="$(sed -n 2p updates.txt)"
          echo "::set-output name=androidUrl::$ANDROID_URL"
          echo "::set-output name=iosUrl::$IOS_URL"
  
      - name: Comment preview
        uses: expo/expo-github-action/[email protected]
        with:
          message: |
            <h2>App</h2>
            <h3>Channel: pr-${{ github.event.number }}</h3>
            <h4>Preview with Android</h4>
            <a href="exp://u.expo.dev/update/${{ steps.update.outputs.androidUrl }}">
              <img src="https://qr.expo.dev/eas-update?updateId=${{ steps.update.outputs.androidUrl }}&appScheme=exp" height="200px" width="200px">
            </a>
            <h4>Preview with iOS</h4>
            <a href="exp://u.expo.dev/update/${{ steps.update.outputs.iosUrl }}">
              <img src="https://qr.expo.dev/eas-update?updateId=${{ steps.update.outputs.iosUrl }}&appScheme=exp" height="200px" width="200px">
            </a>
            <h4>Preview with Debug App </h4>
            <a href="exp+<YOUR_SCHEME>://expo-development-client/?url=https%3A%2F%2Fu.expo.dev%2F7b714e0a-2c36-4915-baf8-fc5ba974b842%3Fchannel-name%3Dpr-${{ github.event.number }}">
              <img src="https://qr.expo.dev/development-client?appScheme=exp%2B<YOUR_SCHEME>&url=< YOUR_EXPO_UPDATES_URL >" height="200px" width="200px">
            </a>

This allows you to have expo and dev client QR codes in the same comment. We found it useful because some of our testers only have Expo Go installed, but we still able to test it using dev client.

@mikecfisher
Copy link

Hi all, I'm trying to workaround this bug myself but I'm missing the <YOUR_SCHEME> part. Where should I look for this value?

I'm basically just trying to make a QR code appear that you can plug into Expo Go with changes specific to a PR for QA.

@kdawgwilk
Copy link

<YOUR_SCHEME> is the custom URI scheme mobile apps use for deep linking and universal links I.e. expo+myapp://. you can find that in your app.json file or Xcode build settings under capabilities

@mikecfisher
Copy link

mikecfisher commented Nov 15, 2022

Hi all, trying to get one of the easier examples above to work. I just want to preview to generate a QR code that I can open in Expo Go on iOS. I can see the update being published successfully in EAS but I can't get the comment feature to generate a usable QR code.

This is what my action looks like for the comment. Any idea what I'm doing wrong?

Note: I changed some of the digits to be 1234 so it doesn't expose our actual app.

      - name: 💬 Comment preview
        uses: expo/expo-github-action/preview-comment@v7
        with:
          message: '<h2>Your Project!</h2><h3>Channel: pr-${{ github.event.number }}</h3><a href="exp+heir://expo-development-client/?url=https%3A%2F%2Fu.expo.dev%123456789-89bc-1234-2135-9ec5d2fb990b%3Fchannel-name%3Dpr-${{ github.event.number }}"><img src="https://qr.expo.dev/development-client?appScheme=exp%2Bheir&url=https%3A%2F%2Fu.expo.dev%2F025da647-1234-1234-1234-12345678%3Fchannel-name%3Dpr-${{ github.event.number }}" height="200px" width="200px"></a>'

@matallui
Copy link

@mikefisher84 in your <img> your appScheme is incorrect. Just remove the exp+ bit. That's only used for deep links.

@matallui
Copy link

Thanks to the comments on this ticket I did manage to get the QR code working as desired.
The only thing that I couldn't get to work was the deep link, i.e., using a link like

<a href="exp+foo://your.link">
  <img something />
</a>

It looks like Github only allows https links (or at least it won't allow deep links). Deep links seem to get converted by github to a link to the image itself, or removed altogether.

Did anyone get the deep link to work? If so, how?

@LucasLFurini
Copy link

When I try to use expo/[email protected], the action fails saying that couldn't find version 7.2.0, what should I do?

@Mazuh
Copy link

Mazuh commented Jan 9, 2023

Thanks to the comments here, I created a custom solution on another repo: nearform/optic-expo#921

@github-actions
Copy link

🎉 This issue has been resolved in version 8.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@davideroffo
Copy link

davideroffo commented Feb 21, 2023

I'm still experiencing the issue where the generated QR code is not valid with v8.

The generated QR code seems invalid: QR code detected no usable data found.

If I decode the generated QR Code:

I tested it with my iPhone with Expo Go installed.

name: expo-eas-update

on:
  workflow_call:
    secrets:
      expo-token:
        description: 'expo token'
        required: true
    inputs:
      channel:
        type: string
      message:
        type: string

jobs:
  eas-update:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
      - name: Setup repo
        uses: actions/checkout@v3
      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version-file: '.nvmrc'
      - name: Setup EAS
        uses: expo/expo-github-action@v8
        with:
          expo-cache: true
          expo-version: latest
          eas-version: latest
          token: ${{ secrets.expo-token }}
      - name: Install dependencies
        run: yarn
      - uses: actions/github-script@v6
        id: sanitise-double-quotes
        with:
          script: return `${{ inputs.message }}`.replaceAll('"',"'")
          result-encoding: string
      - name: Create preview
        uses: expo/expo-github-action/preview@v8
        with:
          command: eas update --branch ${{ inputs.channel }} --message "${{ steps.sanitise-double-quotes.outputs.result }}"

PR: nearform/optic-expo#1012

@georgibakken
Copy link

I am getting the same message when trying to scan the QR code with v8. no usable data found

@danielgangverk
Copy link

danielgangverk commented Mar 10, 2023

Adding the field

  "scheme": "your-app-name",

In app.json / app.config.json

Allowed the preview comment to work in version 8 of preview-comment
If I skip the app scheme the QR code will default to Expo go but with the scheme added it will give me a eas update QR code.

- name: 💬 Comment preview
uses: expo/expo-github-action/preview@v8
with:
  comment: true
  command: eas update --auto --non-interactive
  comment-id: auto-preview

@georgibakken
Copy link

Thanks for the tip. I do already have the scheme, and this is the QR code url.

On iOS in the camera app, it gives me No usable data found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.