Expo and bitbucket pipelines

Is there way that build apk through bitbucket pipelines ?

i think this should be possible but i’m not aware of previous work to do this. maybe someone else can share if they have done it.

I believe Cedric made mention of bitbucket in the developers Slack recently. Any insight on this, @bycedric?

Yes, we at Peakfijn are using Bitbucket Pipelines for our (Expo) deployments and builds.

Right now we have set everything up using the simple exp cli. This means that the actual building process takes place at Expo itself. It also means that we can only build non-detached projects. I’m sure building android apps in general is also possible in Bitbucket Pipelines, but I have no experience with that.

Below I’ve added a stripped-down version of our pipeline configuration. Here we use a different caching because NPM’s actual cache lives in ~/.npm. We also added a deployment type to allow bitbucket to render the deploy interface too. Finally, both $EXPO_USERNAME and $EXPO_PASSWORD are protected environment variables in Pipelines and are set within the admin panel of the repository.

    npm: $HOME/.npm
image: node:alpine
    - step:
        name: Deploy to Expo
        trigger: manual
        deployment: staging
          - npm
          - apk add --no-cache bash
          - cp ./.env.master ./.env
          - npm install
          - npx exp login -u $EXPO_USERNAME -p $EXPO_PASSWORD
          - npx exp publish --non-interactive

Keep in mind that this only publishes to the default release channel, it doesn’t build an APK. However, you can start a build request by replacing npx exp publish --non-interactive with npx exp build:android --no-wait. This will dump a build URL which you can monitor and download the eventual APK from.

Watch the --no-wait in the build request. Bitbucket Pipelines is billed in minutes, so it would be a waste when you are just waiting on the build to finish…

Hope it helps!
:heart: Cedric

1 Like

We’ve learned a lot about Pipelines, automatic releases and Expo. If there is some need for it, I can try and take some time to write a Medium post about what we have done internally. Spoiler alert, we also created a semantic release plugin for expo. :grimacing:


Hey Cedric, that sounds super interesting! Drop me a line at jess@expo.io?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.