AppForShareGet a token

Upload from CI

GitLab CI

Add a share job after your build job. GitLab passes the build file between jobs as an artifact, and the share job uploads it with the commit message as release notes.

1. Add your token

Create an API token under Dashboard, Settings, API tokens (Pro and Team). Settings, CI/CD, Variables, add APPFORSHARE_TOKEN with Masked (and Protected if only protected branches should upload). The CLI reads it from the APPFORSHARE_TOKEN environment variable.

2. .gitlab-ci.yml

The JSON output (url, slug, version, channel) is kept as an artifact so later jobs or a merge request comment can use the link.

stages: [build, share]

build_android:
  stage: build
  image: eclipse-temurin:17
  script:
    - ./gradlew assembleRelease
  artifacts:
    paths: [app/build/outputs/apk/release/app-release.apk]

share:
  stage: share
  image: node:22
  needs: [build_android]
  script:
    - npx --yes appforshare upload app/build/outputs/apk/release/app-release.apk --notes "$CI_COMMIT_MESSAGE" --channel beta --json > appforshare.json
  artifacts:
    paths: [appforshare.json]

Good to know

  • iOS builds need a macOS runner (your own, or GitLab hosted macOS runners on paid tiers). Export an ad hoc .ipa there and pass it as an artifact the same way.
  • Add --channel beta to keep one stable link for testers, and --fail-on blocked to stop the pipeline when the store readiness check finds a blocker (exit code 2; the build stays uploaded).
  • The command prints the install link. Add --json for url, slug, version and channel as JSON. All options are on Upload from CI.

Questions

Does it work on self-managed GitLab?
Yes. The job only needs outbound https to appforshare.io and a runner image with Node 18 or newer.
Can I post the link to the merge request?
Read url from appforshare.json and post it with the GitLab API, or add a webhook in AppForShare that posts every new build to Slack or Microsoft Teams.

Other CI systems

GitHub Actions and FastlaneCircleCIBitbucket PipelinesJenkinsAzure PipelinesXcode CloudCodemagicBitriseExpo EAS