AppForShareGet a token

Upload from CI

Azure Pipelines

A replacement for the App Center distribute task: add a script step after the build. Azure does not pass secret variables to scripts on its own, so the step maps the token into its environment.

1. Add your token

Create an API token under Dashboard, Settings, API tokens (Pro and Team). Pipeline, Edit, Variables, add APPFORSHARE_TOKEN and tick Keep this value secret (or use a variable group). The CLI reads it from the APPFORSHARE_TOKEN environment variable.

2. azure-pipelines.yml

Build.SourceVersionMessage is the commit message. The env block is required for secret variables.

pool:
  vmImage: macos-latest

steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '22.x'
  - script: ./gradlew assembleRelease
    displayName: Build
  - script: >
      npx --yes appforshare upload app/build/outputs/apk/release/app-release.apk
      --notes "$(Build.SourceVersionMessage)" --channel beta
    displayName: Share with testers
    env:
      APPFORSHARE_TOKEN: $(APPFORSHARE_TOKEN)

Good to know

  • On macOS agents, export the .ipa with the Xcode task (ad hoc or enterprise signing) and upload $(Build.ArtifactStagingDirectory)/YourApp.ipa.
  • 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

We used the App Center task. What changes?
Replace the AppCenterDistribute task with the script step above. Testers get an install link and QR code instead of the App Center portal; tester groups and channels replace distribution groups.
Why is the token empty in my script?
Secret variables are not given to scripts unless you map them, which is what the env block does.

Other CI systems

GitHub Actions and FastlaneCircleCIGitLab CIBitbucket PipelinesJenkinsXcode CloudCodemagicBitriseExpo EAS