Pgyer Docs
CI/CD & Dev Tools

Upload via Fastlane

Install and configure Pgyer's Fastlane plugin to upload the Android, iOS, and HarmonyOS builds Fastlane produces.

Fastlane is an automation tool for iOS and Android developers that strings together build, signing, testing, and release into a single workflow. Pgyer's official Fastlane plugin, fastlane-plugin-pgyer, uploads .ipa, .apk, and HarmonyOS .hap builds to Pgyer and returns the download page and QR code.

For help choosing between the API, CLI, CI/CD plugins, MCP, and Agent Skill, see Automated App Uploads and CI/CD Integration.

Prerequisites

Install the Plugin

In your project directory, run:

fastlane add_plugin pgyer

If the plugin is already installed, run fastlane update_plugins to get the latest version.

Store the API Key

Keep the API key in the PGYER_API_KEY environment variable (a secret in CI) rather than in your Fastfile:

export PGYER_API_KEY=your_api_key

You can also pass it as pgyer(api_key: "...").

Configure a Lane

In fastlane/Fastfile, add pgyer after the build action. The plugin uses the build that gym or gradle produced in the same lane, or the file you set with ipa, apk, or hap.

lane :beta do
  gradle(task: "assembleRelease")
  pgyer(update_description: "Fixed the login crash")
end
lane :beta do
  build_app(export_method: "ad-hoc")
  pgyer(update_description: "Fixed the login crash")
end

Build and sign the app with DevEco Studio or hvigorw assembleHap first, then upload the .hap file:

lane :beta_harmony do
  pgyer(
    hap: "entry/build/default/outputs/default/entry-default-signed.hap",
    update_description: "Fixed the login crash"
  )
end

Build and Upload

In your project directory, run:

fastlane beta

When the upload finishes, the output looks like this:

Build file: ./app/build/outputs/apk/release/app-release.apk (android)
Uploading app-release.apk (35.2 MB)...
Upload finished. Waiting for PGYER to process the build...
Published PGYER Demo 1.0.0 (build 1)
Download page: https://www.pgyer.com/pgyerdemo
QR code: https://www.pgyer.com/app/qrcodeHistory/...

Common Options

OptionEnvironment variableDescription
api_keyPGYER_API_KEYRequired. Your Pgyer API key
apk, ipa, hapPGYER_APK, PGYER_IPA, PGYER_HAPThe build to upload; set at most one. Without one, the build from gym or gradle in the same lane is used
update_descriptionPGYER_UPDATE_DESCRIPTIONRelease notes for this version
descriptionPGYER_DESCRIPTIONApp description
install_typePGYER_INSTALL_TYPE1 public, 2 password, 3 invitation only. If not set, the previous version's setting is kept; password alone selects password install
passwordPGYER_PASSWORDInstall password
install_start_date, install_end_datePGYER_INSTALL_START_DATE, PGYER_INSTALL_END_DATEInstall period, such as 2026-01-01. Set both
channelPGYER_SPECIFIED_CHANNELShort link of the channel to update
user_download_file_namePGYER_USER_DOWNLOAD_FILE_NAMEFile name testers download, in plain ASCII. Defaults to the name of the uploaded file
overseaPGYER_OVERSEAtrue for overseas upload acceleration, false for mainland China. If not set, Pgyer chooses by IP address
processing_timeoutPGYER_PROCESSING_TIMEOUTSeconds to wait for Pgyer to process the build after the upload. Default 600

Run fastlane action pgyer to see every option, or read the plugin documentation.

Use the Result

pgyer returns the build information from Pgyer, including appPgyerURL (the download page) and appQRCodeURL (the QR code image). The same values are stored in lane_context as PGYER_DOWNLOAD_URL and PGYER_QRCODE_URL, so later steps can use them, for example to send a notification:

lane :beta do
  build_app(export_method: "ad-hoc")
  result = pgyer(update_description: "Fixed the login crash")
  slack(message: "New beta: #{result['appPgyerURL']}")
end

Upgrading from Earlier Versions

Version 0.5.0 changes the following:

  1. Without install_type, the previous version's install setting is kept. Earlier versions made the app public on every upload; set install_type: "1" if you want that.
  2. When apk, ipa, or hap is set, that file is uploaded, and the app type comes from its extension.
  3. Waiting for Pgyer to process the build stops after processing_timeout seconds instead of waiting forever.

Troubleshooting

SymptomWhat to do
Error loading plugin 'fastlane-plugin-pgyer' or Unable to activate faraday_middlewarePlugin 0.3.x doesn't load on Fastlane 2.238.0 or later. Run fastlane update_plugins
API errors such as a wrong API key, missing real-name verification, or full storageThe log shows Pgyer's error code and how to fix it
PGYER is still processing the build after 600 secondsThe upload finished, so the build may still appear in your app list. For large builds, raise processing_timeout
None of the PGYER API servers could be reachedThe plugin tries www.pgyer.com, www.xcxwo.com, and www.pgyerapp.com in turn. Check your network and proxy (HTTPS_PROXY is supported); if your DNS blocks these domains, set doh: true
The wrong build was uploadedSet the file explicitly with apk, ipa, or hap

On this page