Skip to content

CI/CD Integration

GPC is designed for automation. Every command returns structured output, uses deterministic exit codes, and accepts configuration through environment variables -- no interactive prompts in CI.

Why GPC Is CI-Native

FeatureHow It Helps in CI
JSON outputParse results with jq, store in variables, pass between steps
Exit codes 0-6Branch pipeline logic on success, auth failure, threshold breach, etc.
Env var configGPC_SERVICE_ACCOUNT, GPC_APP -- no config files needed
--dry-runValidate changes in PR checks without modifying Play Console state
--no-interactiveAuto-set when CI=true is detected; never blocks on prompts
Markdown outputWrite directly to $GITHUB_STEP_SUMMARY with --output markdown

Exit Codes

Every GPC command exits with a code that CI systems can act on.

CodeMeaningCI Action
0SuccessContinue pipeline
1General errorFail the job
2Usage error (bad arguments)Fix the command invocation
3Authentication errorCheck GPC_SERVICE_ACCOUNT secret
4API error (rate limit, permission denied)Retry or check permissions
5Network errorRetry the step
6Threshold breach (vitals gating)Halt rollout, alert team
10Plugin errorCheck plugin configuration
bash
# Branch on exit code in a CI script
gpc vitals crashes --threshold 2.0
EXIT_CODE=$?

case $EXIT_CODE in
  0) echo "Vitals healthy, proceed" ;;
  6) echo "Threshold breached, halting rollout"; gpc releases rollout halt --track production ;;
  *) echo "Unexpected error: $EXIT_CODE"; exit 1 ;;
esac

Install Options in CI

npm (Node.js available)

yaml
- run: npm install -g @gpc-cli/cli

Best when Node.js is already in your pipeline. Includes plugin support (@gpc-cli/plugin-ci for GitHub Actions step summaries).

Standalone Binary (no dependencies)

yaml
- run: curl -fsSL https://raw.githubusercontent.com/yasserstudio/gpc/main/scripts/install.sh | sh

No Node.js required. Downloads the platform-specific binary with SHA256 checksum verification. Ideal for Docker images and minimal CI runners.

Homebrew (macOS runners)

yaml
- run: brew install yasserstudio/tap/gpc

@gpc-cli/plugin-ci

Install @gpc-cli/plugin-ci alongside GPC to get automatic CI environment detection and GitHub Actions step summaries.

bash
npm install -g @gpc-cli/cli @gpc-cli/plugin-ci

When running in GitHub Actions with $GITHUB_STEP_SUMMARY available, the plugin writes a markdown summary after each command with:

  • Command name and arguments
  • App package name
  • Duration
  • Exit code
  • Error details (on failure)

Detected CI Providers

ProviderDetection VariableBuild IDBranch Variable
GitHub ActionsGITHUB_ACTIONS=trueGITHUB_RUN_IDGITHUB_REF_NAME
GitLab CIGITLAB_CI=trueCI_JOB_IDCI_COMMIT_BRANCH
JenkinsJENKINS_URLBUILD_NUMBERBRANCH_NAME
CircleCICIRCLECI=trueCIRCLE_BUILD_NUMCIRCLE_BRANCH
BitriseBITRISE_IO=trueBITRISE_BUILD_NUMBERBITRISE_GIT_BRANCH
GenericCI=true----

Environment Variables

Configure GPC entirely through environment variables. No config files needed in CI.

VariableDescriptionRequiredDefault
GPC_SERVICE_ACCOUNTService account JSON string or file pathYes (CI)--
GPC_APPDefault package nameRecommended--
GPC_DEVELOPER_IDDeveloper account ID (for user/permission commands)No--
GPC_PROFILEAuth profile nameNo--
GPC_OUTPUTDefault output formatNojson (non-TTY)
GPC_NO_COLORDisable color outputNoAuto in CI
GPC_NO_INTERACTIVEDisable interactive promptsNoAuto when CI=true
GPC_MAX_RETRIESMax retry attempts on transient errorsNo3
GPC_TIMEOUTRequest timeout in millisecondsNo30000
GPC_BASE_DELAYBase retry delay in millisecondsNo1000
GPC_MAX_DELAYMax retry delay in millisecondsNo60000
GPC_RATE_LIMITRequests per secondNo50
GPC_CA_CERTCustom CA certificate pathNo--
HTTPS_PROXYHTTP proxy URLNo--

Secrets Management

Store GPC_SERVICE_ACCOUNT as an encrypted secret in your CI provider. The value can be either:

  • JSON string -- the full service account JSON content (recommended for CI)
  • File path -- path to a mounted service account key file
yaml
# GitHub Actions
env:
  GPC_SERVICE_ACCOUNT: ${{ secrets.GPC_SERVICE_ACCOUNT }}

# GitLab CI
variables:
  GPC_SERVICE_ACCOUNT: $GPC_SERVICE_ACCOUNT

# CircleCI (use context or project env)
environment:
  GPC_SERVICE_ACCOUNT: $GPC_SERVICE_ACCOUNT

WARNING

Never hardcode credentials in workflow files, echo credential values in logs, or store credentials as build artifacts.

JSON Output Contract

All GPC commands in CI default to JSON output (auto-detected when stdout is not a TTY). The format is consistent across all commands:

json
{
  "success": true,
  "data": {},
  "metadata": {
    "command": "releases upload",
    "timestamp": "2026-03-09T12:00:00Z",
    "duration_ms": 4200
  }
}

Error responses:

json
{
  "success": false,
  "error": {
    "code": "AUTH_EXPIRED",
    "message": "Access token has expired",
    "suggestion": "Run 'gpc auth login' to re-authenticate"
  }
}

Parse JSON output with jq in CI scripts:

bash
# Extract version code after upload
VERSION=$(gpc releases upload app.aab --track internal --json | jq -r '.data.versionCode')

# Check if command succeeded
gpc releases status --json | jq -e '.success' > /dev/null

Next Steps

Released under the MIT License.